Oct 3rd, 2011, 03:46 PM
Local JMX Management
In all of my searching for how to use JMX with Spring, I find a plethora of information on remote management. However, I have yet to find any kind of guidance on local managment.
I follow the guidance (like this: http://static.springsource.org/sprin...rence/jmx.html) and I am successfully able to make a rudimentary JMX client that accesses the MBean server via RMI (the serviceUrl that I provide my ConnectorServerFactoryBean is: "service:jmx:rmi://localhost/jndi/rmi://localhost:1099/blahblah").
However, it seems to me to be overkill to use this implementation when both the MBean server and client exist not only on the same machine, but within the same container. I have one web application deployed in Tomcat that registers some MBeans with the server. I then have another web application, in the same Tomcat instance, that needs to manage those MBeans. Is there a way to do this strictly in a local fashion, or should I stick with using the above solution.
Also, does setting up the JMX-RMI URL above (service:jmx:rmi://localhost/jndi/rmi://localhost:1099/blahblah) expose a security vulnerability outside the container that I need to address?
Oct 4th, 2011, 09:55 AM
...and I feel silly, because the solution was super simple and right under my nose. All I had to do in my JMX client is create a bean with the "org.springframework.jmx.support.MBeanServerFactor yBean" class, setting the "locateExistingServerIfPossible" property to true. Then, I just wired that bean right into my client class and had instant access to an MBeanServer object for managing all the registered MBeans.
I can't believe I spent so much time searching around when this is all I had to do! I guess I do have a knack for making things harder than they need to be...