4 Replies Latest reply on Jul 2, 2009 10:35 AM by ips

    Problems with JMX plugin in AS 5.1.0.GA

    jmesnil

      Hi,

      I want to create a jopr plug-in to manage JMX MBeans in Embedded Jopr in AS 5.1.0.GA.

      I create the plugin jar with the config:

       <depends plugin="JMX" />
      
       <service name="Messaging Service"
       description="JBoss Messaging Service"
       discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent"
       class="org.rhq.plugins.jmx.MBeanResourceComponent">
      
       <runs-inside>
       <parent-resource-type name="JMX Server" plugin="JMX"/>
       </runs-inside>
      
       <plugin-configuration>
       <c:simple-property name="objectName"
       default="org.jboss.messaging:module=Core,type=Server"
       readOnly="true"/>
       </plugin-configuration>
       </service>
      


      I've added it to deploy/admin-console.war/plugins.
      I also copied the rhq-jmx-plugin-1.3.0-SNAPSHOT.jar to the plugins dir.

      When I start JBoss and logged in the console, I got the error:

      18:10:47,943 INFO [BootstrapAction] Initializing Administration Console v1.2.0.GA...
      18:10:52,921 WARN [SystemInfoFactory] System info API not accessible on this platform (native shared library not found in java.library.path).
      18:10:53,181 INFO [PluginContainerResourceManager] Discovering Resources...
      18:10:53,269 WARN [JMXDiscoveryComponent] Unable to complete base jmx server discovery (enable DEBUG for stack): java.lang.UnsupportedOperationException: No native library available - Cannot get the process table information without native support
      18:11:01,815 INFO [RuntimeDiscoveryExecutor] Running runtime discovery scan rooted at platform...
      18:11:03,903 ERROR [RuntimeDiscoveryExecutor] Unable to obtain discovery component for [ResourceType[id=0, category=Service, name=Messaging Service, plugin=JBossMessaging]]
      org.rhq.core.clientapi.agent.PluginContainerException: Could not find plugin class org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent] from plugin environment [PluginEnvironment[pluginName=JBossMessaging, pluginDesciptorLoader=PluginDescriptorLoader[pluginJarUrl=jndi:/localhost/admin-console/plugins/jopr-jboss-messaging-2-plugin-2.3.0-SNAPSHOT.jar, pluginClassLoader=org.rhq.core.pc.plugin.PluginClassLoader@61033952]]]
       at org.rhq.core.pc.plugin.PluginComponentFactory.instantiateClass(PluginComponentFactory.java:135)
       at org.rhq.core.pc.plugin.PluginComponentFactory.getDiscoveryComponent(PluginComponentFactory.java:78)
       at org.rhq.core.pc.inventory.RuntimeDiscoveryExecutor.discoverForResource(RuntimeDiscoveryExecutor.java:205)
       at org.rhq.core.pc.inventory.RuntimeDiscoveryExecutor.runtimeDiscover(RuntimeDiscoveryExecutor.java:134)
       at org.rhq.core.pc.inventory.RuntimeDiscoveryExecutor.call(RuntimeDiscoveryExecutor.java:94)
       at org.rhq.core.pc.inventory.RuntimeDiscoveryExecutor.call(RuntimeDiscoveryExecutor.java:51)
       at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
       at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      


      It seems the JMX plugin is not properly initialized and thus my plugin is not initialized too.

      Thanks to help on the #jopr IRC channel, I've been told to add sigar files ( libsigar-universal-macosx.dylib and sigar-*.jar) to make it work.
      I copied them from JOPR 2.2 download from https://www.jboss.org/community/wiki/Jopr-Releases

      I added the dylib the sigar jar to server/../lib but I got no more success.
      I also add the dylib to LD_LIBRARY_PATH without success.
      I make sure that the dylib is in java.libary.path but I still got the same error

      What are the steps to be able to use the JMX plugin?
      I don't understand why I'd need a native lib to be able to manage components through JMX...

      (I'm on Mac OS X 10.5.7 but I've got the same issue on Linux)


        • 1. Re: Problems with JMX plugin in AS 5.1.0.GA
          ips

          Yes, you're right - SIGAR is not needed by Embedded Jopr. Even in Enterprise Jopr, it's optional and only needed in order to do auto-discovery of servers and some other optional features such as collection of platform/OS metrics.

          I think changing the following line in your plugin descriptor:

          <depends plugin="JMX"/>


          to:

          <depends plugin="JMX" useClasses="true"/>


          will fix your issue.

          Let me know if that does the trick.


          • 2. Re: Problems with JMX plugin in AS 5.1.0.GA
            mazz

            FYI: if you never specify a "useClasses" attribute in any of your depends tags, the LAST depends tag will default its value to "true". So, in other words, the last depends tag listed in your descriptor will automatically have "useClasses=true" and you won't have to add it (I still like to put it in there to be explicit about it, to make it obvious to anyone looking at it that I meant to do it). This means that plugin will have its classes placed in your plugin's classloader (technically, your plugin's classloader will have a parent classloader which is that of the depends plugin whose useClasses is true).

            • 3. Re: Problems with JMX plugin in AS 5.1.0.GA
              jmesnil

               

              "ips" wrote:

              Let me know if that does the trick.


              Thanks Ian! With this fix, I no longer have warning when my plugin is loaded.

              However, it is still not displayed in the admin console GUI.
              I've have these logs:

              11:48:06,319 INFO [PluginContainerResourceManager] Discovering Resources...
              11:48:06,429 WARN [JMXDiscoveryComponent] Unable to complete base jmx server discovery (enable DEBUG for stack): java.lang.UnsupportedOperationException: No native library available - Cannot get the process table information without native support
              11:48:15,643 INFO [RuntimeDiscoveryExecutor] Running runtime discovery scan rooted at platform...
              11:48:17,642 INFO [RuntimeDiscoveryExecutor] Scanned 0 servers and found 0 total descendant Resources.
              11:48:17,801 INFO [RuntimeDiscoveryExecutor] Running runtime discovery scan rooted at platform...
              11:48:18,646 INFO [RuntimeDiscoveryExecutor] Scanned 0 servers and found 0 total descendant Resources.
              


              I thought the issue could be that JOPR does not pick JBoss AS MBeanServer so I added -Djboss.platform.mbeanserver when running the AS but nothing changed.
              How do I display the managed JMX servers?

              thanks for the help!


              • 4. Re: Problems with JMX plugin in AS 5.1.0.GA
                ips

                Please try adding the "JBossAS5:JBossAS Server" ResourceType to the runs-inside section of your plugin descriptor, e.g.:

                <runs-inside>
                 <parent-resource-type name="JMX Server" plugin="JMX"/>
                 <parent-resource-type name="JBossAS Server" plugin="JBossAS"/>
                 <parent-resource-type name="JBossAS Server" plugin="JBossAS5"/>
                 </runs-inside>