I've tried pretty much everything so far, but haven't been able to get jmx working with spring. I'm building a webapp which will run in a Tomcat environment and Java 1.6.
Basically (now) I've got:
The class to be exposed is annotated with @ManagedResource and the operations with @ManagedOperation. I've tried all the other ways of defining the xml file from the spring chapter on jmx
<bean id="jmxControl" class="com..jmx.AdServerManagement" />
Everything works fine when taken to a separate project (non-Tomcat). The class does instantiates in the Tomcat project too, but the export to the MBean server does not seem to happen.
I can get this to work via the classic method:
but I'd like to be able to use the spring annotations.
mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName clientName = new ObjectName("Adserver:name=adserver");