Single MBeanServer for multiple JVMs
Hi - wonder if you can help
We are presently implementing JMX within our application. Our application runs in standalone mode, ie runs in it's own JVM, but there can be multiple instances of the application running on the same server. Presently each app creates it's own MBeanServer, which registers itself with and an RMI Server running on the same box. To monitor each instance of application we have to create a separate connection to each MBeanServer (we're using the MX4J implementation & MC4J client). We were wondering whether it would be viable to create a single running MBeanServer (probably running in the same JVM as the RMIServer) and have each application JVM connecting and registering with this single MBeanServer, rather than have an MBeanServer per JVM. This would reduce the number of connections you need to setup on the client (we could have a lot of JVMs running !).
Is this possible to do, is it recommended (!) and if the answer to these questions were both 'yes !' have you got any examples on how to do it.
Thanks in advance, Neil.
[1093 byte] By [
elliottna] at [2007-11-26 17:21:59]

# 1
Hi Eliott,
What you describe is a use case for MBeanServer federation - aka cascading.
http://forum.java.sun.com/thread.jspa?threadID=5123284&messageID=9436134#9436134
Each application instance would have its own MBeanServer and its own
JMXConnectorServer, but they would all be federated in a single MBeanServer
which would act as 'master MBeanServer'.
The client would only need to connect to that master MBeanServer.
FYI, the Java DMK - which is a Sun commercial product, has a ready to use
implementation of such a cascading feature. See
http://java.sun.com/products/jdmk/index.jsp
http://docs.sun.com/app/docs/doc/816-7609/6mdjrf87n
Eamonn McManus also recently published an excellent blog article explaining
how to build your own:
http://weblogs.java.net/blog/emcmanus/archive/2007/02/cascading_its_a.html
Note also that federation of MBeanServers is a feature proposed for standardization
within JSR 255 (JMX 2.0 / JDK 7) [Will not be exactly what is present in the Java DMK]
See:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6446447
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5072476
Hope this helps,
-- daniel
JMX, SNMP, Java, etc...
http://blogs.sun.com/jmxetc