3 Replies Latest reply on Jan 3, 2015 7:59 AM by garethahealy

    Exposing custom mbean to JON

    garethahealy

      I am trying to expose a custom MBean from JBoss Fuse (mbeans-expose-context.xml) to JON. When using JConsole, i can see the MBean, so thats all working fine.

       

      I've then created a simple plugin (rhq-plugin.xml) and deployed it. But it never shows up in JON.


      I am expecting to to be shown under the tree @ localhost -> JBoss Fuse Containers -> Container -> Simple MBeans


      Can anyone see what i am doing wrong...

        • 1. Re: Exposing custom mbean to JON
          jayshaughnessy

          I don't see anything visibly wrong unless the mbean name is not correct.  Are you sure that the plugin deployed correctly?   Any errors?  Does it show up in the agent plugins list in the Administration view via the GUI?   Are you sure it was updated on the agent?  A newly deployed plugin on the server does not get updated immediately on a running agent.  Restarting the agent, or executing the "Update All Plugins" operation is required for an on-demand update.

          • 2. Re: Exposing custom mbean to JON
            garethahealy

            So looking through the logs, i can see the plugin has been deployed correctly (agent.log):

             

            2015-01-03 12:36:13,503 INFO  [main] (org.rhq.enterprise.agent.PluginUpdate)- {PluginUpdate.downloading}Downloading the plugin [simple-mbeans-1.0.0-SNAPSHOT.jar]...
            2015-01-03 12:36:13,540 INFO  [main] (org.rhq.enterprise.agent.PluginUpdate)- {PluginUpdate.downloading-complete}The plugin [SimpleMBeans] has been updated at [simple-mbeans-1.0.0-SNAPSHOT.jar]. 2015-01-03 12:36:13,540 INFO  [main] (org.rhq.enterprise.agent.PluginUpdate)- {PluginUpdate.updating-complete}Completed updating the plugins to their latest versions.
            2015-01-03 12:36:14,699 DEBUG [main] (rhq.core.pc.plugin.PluginManager)- Plugin found at: file:/opt/rh/rhq-agent/plugins/simple-mbeans-1.0.0-SNAPSHOT.jar
            2015-01-03 12:36:14,699 DEBUG [main] (rhq.core.clientapi.descriptor.AgentPluginDescriptorUtil)- Loading plugin descriptor from plugin jar at [file:/opt/rh/rhq-agent/plugins/simple-mbeans-1.0.0-SNAPSHOT.jar]...
            2015-01-03 12:36:15,305 DEBUG [main] (rhq.core.pc.plugin.ClassLoaderManager)- Creating classloader for dependent plugin [SimpleMBeans] from URL [file:/opt/rh/rhq-agent/plugins/simple-mbeans-1.0.0-SNAPSHOT.jar] that has the following dependencies: [JMX, Servicemix3, Servicemix4, Fabric, JBossFuse]
            2015-01-03 12:36:15,305 DEBUG [main] (rhq.core.pc.plugin.ClassLoaderManager)- Created classloader for plugin jar [file:/opt/rh/rhq-agent/plugins/simple-mbeans-1.0.0-SNAPSHOT.jar] with additional jars [null]
            2015-01-03 12:36:15,305 DEBUG [main] (rhq.core.pc.plugin.PluginManager)- Loading plugin from [file:/opt/rh/rhq-agent/plugins/simple-mbeans-1.0.0-SNAPSHOT.jar] in classloader [PluginClassLoader@1de76b6[parent=PluginClassLoader@5a996453[parent=org.rhq.core.pc.plugin.RootPluginClassLoader@1ed92ae,embedded-dir=[file:/opt/rh/rhq-agent/data/tmp/rhq-jmx-plugin-4.12.0.JON330GA.jar6050118178201101811.classloader/],urls=[file:/opt/rh/rhq-agent/plugins/rhq-jmx-plugin-4.12.0.JON330GA.jar,org-mc4j-ems-1.3.6-rhq.jar224138619179351904.tmp]],embedded-dir=[<>],urls=[file:/opt/rh/rhq-agent/plugins/simple-mbeans-1.0.0-SNAPSHOT.jar]]]...
            2015-01-03 12:36:15,305 DEBUG [main] (rhq.core.pc.plugin.PluginDescriptorLoader)- Created PluginDescriptorLoader [pluginJarUrl=file:/opt/rh/rhq-agent/plugins/simple-mbeans-1.0.0-SNAPSHOT.jar, pluginClassLoader=PluginClassLoader@1de76b6[parent=PluginClassLoader@5a996453[parent=org.rhq.core.pc.plugin.RootPluginClassLoader@1ed92ae,embedded-dir=[file:/opt/rh/rhq-agent/data/tmp/rhq-jmx-plugin-4.12.0.JON330GA.jar6050118178201101811.classloader/],urls=[file:/opt/rh/rhq-agent/plugins/rhq-jmx-plugin-4.12.0.JON330GA.jar,org-mc4j-ems-1.3.6-rhq.jar224138619179351904.tmp]],embedded-dir=[<>],urls=[file:/opt/rh/rhq-agent/plugins/simple-mbeans-1.0.0-SNAPSHOT.jar]]] 2015-01-03 12:36:15,305 DEBUG [main] (core.clientapi.agent.metadata.PluginMetadataParser)- Parsed service Resource type: ResourceType[id=0, name=SimpleMBeans Service, plugin=SimpleMBeans, category=Service]
            2015-01-03 12:36:15,305 WARN  [main] (core.clientapi.agent.metadata.PluginMetadataParser)- There is no resource type named [JBossAS Server] from a plugin named [JBossAS]. This is probably because that plugin is missing. Resource Type [{SimpleMBeans}SimpleMBeans Service] will not have that missing type as a possible parent.

             

            I then also spotted the below:

             

            2015-01-03 12:36:44,540 DEBUG [InventoryManager.discovery-1] (rhq.core.pc.plugin.PluginComponentFactory)- Created discovery component [org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent] for resource type [SimpleMBeans Service]
            2015-01-03 12:36:44,540 DEBUG [InventoryManager.discovery-1] (rhq.core.pc.inventory.RuntimeDiscoveryExecutor)- Running service scan on parent resource [Resource[id=10151, uuid=b63c1169-4883-433e-a426-3e7cebfa99b2, type={JBossFuse}JBoss Fuse Container, key=JBoss Fuse{/opt/rh/jboss-fuse-6.1.0.redhat-379}, name=JBoss Fuse{/opt/rh/jboss-fuse-6.1.0.redhat-379} JBoss Fuse [root], parent=localhost, version=6.1.0.redhat-379]] looking for children of type [ResourceType[id=0, name=SimpleMBeans Service, plugin=SimpleMBeans, category=Service]]
            2015-01-03 12:36:44,540 DEBUG [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Executing discovery for [SimpleMBeans Service] Resources...
            2015-01-03 12:36:44,541 DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent)- Discovering MBean resources with object name query template: com.garethahealy:beans=whiteboard-mbeans-expose-context,type=beans,name=PoolCounter
            2015-01-03 12:36:44,542 DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent)- Found [0] mbeans for query [com.garethahealy:beans=whiteboard-mbeans-expose-context,type=beans,name=PoolCounter].
            2015-01-03 12:36:44,542 DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent)- [0] services have been added
            2015-01-03 12:36:44,542 DEBUG [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Discovery for [SimpleMBeans Service] resources completed in [2] ms

             

            The key lines being:

             

            (org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent)- Discovering MBean resources with object name query template: com.garethahealy:beans=whiteboard-mbeans-expose-context,type=beans,name=PoolCounter
            (org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent)- Found [0] mbeans for query [com.garethahealy:beans=whiteboard-mbeans-expose-context,type=beans,name=PoolCounter].

             

            So i presume what is happening, is that its not looking at the correct JMX URL, thus fails to find my mbean. i.e.: not the fuse one accessed via: service:jmx:rmi://192.168.0.14:44445/jndi/rmi://192.168.0.14:1100/karaf-esb-uk

             

            So the question is, how do i do that? should i be using the 'FuseMBeanDiscoveryComponent' and add a lib dependancy to the core fuse libs, much like how the camel context plugin works?

            • 3. Re: Exposing custom mbean to JON
              garethahealy

              Ignore the above. The logs for the fuse container, are for the wrong container, thats why it shows 0 found. Its working, as i've just spotted the tree node. I hadn't made any code changes, i presume the agent just needed a force restart (which i did this morning).