MBeanServer merging with JVM agent

classic Classic list List threaded Threaded
2 messages Options
Kevin Kevin
Reply | Threaded
Open this post in threaded view
|

MBeanServer merging with JVM agent

If I add my mbeans to the platform mbean server I can access them from Jolokia.  However, if I add them to a server I create in my application they aren't visible.  I'm assuming the code that Jolokia runs to detect the set of available mbean servers at start-up is running before my code to create my application-specific mbean server.  So is there some way to guarantee my initialization code will run before Jolokia runs its startup code?

Thanks.
roland roland
Reply | Threaded
Open this post in threaded view
|

Re: MBeanServer merging with JVM agent

Unfortunately the JVM offers no way to get a list of all created MBeanServers. Therefor Jolokia tries to detect the server it is running and the uses custom lookup methods for getting the server. See e.g. https://github.com/rhuss/jolokia/blob/master/agent/core/src/main/java/org/jolokia/detector/WeblogicDetector.java#L52-L68

You can either create a custom detector (which is not black magic) for your needs or you use the PlatformMBeanServer which is the only one which can be always detected.

It has nothing todo with the initialization order.

cheers ...
... roland
... roland