<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 19:53:28 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>OpenDaylight JIRA</title>
    <link>https://jira.opendaylight.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.20.10</version>
        <build-number>820010</build-number>
        <build-date>22-06-2022</build-date>
    </build-info>


<item>
            <title>[CONTROLLER-623] ManagementFactory.getPlatformMBeanServer() does not work in karaf</title>
                <link>https://jira.opendaylight.org/browse/CONTROLLER-623</link>
                <project id="10113" key="CONTROLLER">controller</project>
                    <description>&lt;p&gt;This bug was discovered in the context of:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/8963/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/8963/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;trying to do the Karaf work.&lt;/p&gt;

&lt;p&gt;The shell script that starts karaf on line 410 has &lt;br/&gt;
-Djavax.management.builder.initial=org.apache.karaf.management.boot.KarafMBeanServerBuilder&lt;/p&gt;

&lt;p&gt;This causes the config subsystem to break in karaf due to its many uses of:&lt;br/&gt;
ManagementFactory.getPlatformMBeanServer()&lt;br/&gt;
(see ConfigManagerActivator &lt;span class=&quot;error&quot;&gt;&amp;#91;line 32&amp;#93;&lt;/span&gt; for one of many examples).&lt;/p&gt;

&lt;p&gt;If you &lt;br/&gt;
feature:install odl-config-startup from &lt;br/&gt;
&lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/8963/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/8963/&lt;/a&gt;&lt;br/&gt;
in karaf (to launch karaf:&lt;br/&gt;
cd controller/opendaylight/distribution/opendaylight-karaf/;mvn clean install;cd target/;unzip -o controller/opendaylight/distribution/opendaylight-karaf/target/distribution.opendaylight-karaf-1.4.2-SNAPSHOT.zip; cd distribution.opendaylight-karaf-1.4.2-SNAPSHOT/bin;./karaf&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;You will get an exception like the one in the attachment.  This is rooted in karaf JMX RBAC as enforced by the:&lt;br/&gt;
-Djavax.management.builder.initial=org.apache.karaf.management.boot.KarafMBeanServerBuilder&lt;/p&gt;

&lt;p&gt;This can be solved in two ways:&lt;/p&gt;

&lt;p&gt;1)  Remove from the bin/karaf the &lt;br/&gt;
-Djavax.management.builder.initial=org.apache.karaf.management.boot.KarafMBeanServerBuilder&lt;br/&gt;
Disadvantage: It means that if folks try to install us in a normal karaf container there will still be breakage... this is a non-standard way to customize karaf.&lt;/p&gt;

&lt;p&gt;2) Write a ConfigManagementFactory with a getPlatformMBeanServer() that does&lt;br/&gt;
the right thing in Karaf and just passes through to ManagementFactory.getPlatformMBeanServer() everywhere else.  Replace all of our uses of ManagementFactory.getPlatformMBeanServer() with &lt;br/&gt;
ConfigManagementFactory.getPlatformMBeanServer().&lt;/p&gt;

&lt;p&gt;Note... the right thing for karaf looks something like:&lt;/p&gt;

&lt;p&gt;    Map&amp;lt;String,String&amp;gt; h = new HashMap&amp;lt;String,String&amp;gt;();&lt;br/&gt;
    h.put(Context.SECURITY_PRINCIPAL, &#8220;karaf&quot;);&lt;br/&gt;
    h.put(Context.SECURITY_CREDENTIALS, &#8220;karaf&quot;);&lt;/p&gt;

&lt;p&gt;    JMXConnector connector = JMXConnectorFactory.connect(serviceURL, h);&lt;br/&gt;
    MBeanServerConnection con = connector.getMBeanServerConnection();&lt;br/&gt;
Where obviously rather than hardcode the username and password, we read them from properties.&lt;br/&gt;
&lt;a href=&quot;http://karaf.apache.org/manual/latest/users-guide/monitoring.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://karaf.apache.org/manual/latest/users-guide/monitoring.html&lt;/a&gt; gives you the URL, though it should also not&lt;br/&gt;
be hardcoded but rather obtained using ConfigAdmin service and load the org.apache.karaf.management config PID.  Care should be taken to do this in a way that &lt;br/&gt;
does not break if run in our old container.&lt;br/&gt;
Disadvantage: Its work, but I don&apos;t think a &lt;b&gt;lot&lt;/b&gt; of work.&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: Mac OS&lt;br/&gt;
Platform: PC&lt;/p&gt;</environment>
        <key id="25177">CONTROLLER-623</key>
            <summary>ManagementFactory.getPlatformMBeanServer() does not work in karaf</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                                <status id="5" iconUrl="https://jira.opendaylight.org/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10000">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="hagbard">Ed Warnicke</reporter>
                        <labels>
                    </labels>
                <created>Sun, 13 Jul 2014 01:17:35 +0000</created>
                <updated>Thu, 19 Oct 2017 22:13:23 +0000</updated>
                            <resolved>Thu, 17 Mar 2016 12:30:31 +0000</resolved>
                                    <version>Helium</version>
                                                    <component>config</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="48696" author="hagbard@gmail.com" created="Sun, 13 Jul 2014 01:20:47 +0000"  >&lt;p&gt;This is the exception trace that you get if you use &lt;br/&gt;
&lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/8963/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/8963/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and in karaf do:&lt;/p&gt;

&lt;p&gt;feature:install odl-config-startup&lt;/p&gt;

&lt;p&gt;and wait a minute or so.&lt;/p&gt;</comment>
                            <comment id="48701" author="hagbard@gmail.com" created="Sun, 13 Jul 2014 01:20:47 +0000"  >&lt;p&gt;Attachment pastebin has been added with description: Exception trace&lt;/p&gt;</comment>
                            <comment id="48697" author="hagbard@gmail.com" created="Sun, 13 Jul 2014 01:24:08 +0000"  >&lt;p&gt;Side note: What&apos;s actually happening here is that Karaf introduced RBAC for JMX in 3.0, and its tweaked down so hard you really can&apos;t use ManagementFactory.getPlatformMBeanServer()&lt;/p&gt;

&lt;p&gt;(I am honestly unqualified to know if its tweaked down &lt;b&gt;too&lt;/b&gt; hard or not)&lt;/p&gt;</comment>
                            <comment id="48698" author="hagbard@gmail.com" created="Sun, 13 Jul 2014 01:29:04 +0000"  >&lt;p&gt;Correction to one liner for building and running karaf:&lt;/p&gt;

&lt;p&gt;cd controller/opendaylight/distribution/opendaylight-karaf/;mvn clean install;cd target/;unzip -o distribution.opendaylight-karaf-1.4.2-SNAPSHOT.zip; cd distribution.opendaylight-karaf-1.4.2-SNAPSHOT/bin;./karaf&lt;/p&gt;</comment>
                            <comment id="48699" author="rovarga" created="Fri, 18 Jul 2014 17:13:22 +0000"  >&lt;p&gt;So I think we need to go for option #2, which I think will need to occur by installing a platform support bundle:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;one for default JVMs&lt;/li&gt;
	&lt;li&gt;another for Karaf&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Note that adding a remote connector may introduce failure modes which we have not accounted for (like, the connection going down).&lt;/p&gt;</comment>
                            <comment id="48700" author="mmarsale@cisco.com" created="Wed, 10 Sep 2014 15:41:37 +0000"  >&lt;p&gt;Workaround is present in ODL and its being fixed in karaf 3.0.2 (according to Ed)&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="13392" name="pastebin" size="8055" author="eaw@cisco.com" created="Sun, 13 Jul 2014 01:20:47 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_11400" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10208" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
                        <customfieldname>External issue ID</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1359</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10201" key="com.atlassian.jira.plugin.system.customfieldtypes:url">
                        <customfieldname>External issue URL</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[https://bugs.opendaylight.org/show_bug.cgi?id=1359]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10204" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>ODL SR Target Milestone</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10315"><![CDATA[Lithium]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i02ljj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>