I wanted to add JMX to our plain (Spring) application. As a simple test case I basically created the examples test class, added it to the root of the application's classpath, and then added the following lines to the beginning of the Spring configuration file.
When I run the application I do not get any error either in SYSOUT or in the log4j log. However, when I bring up JConsole, I only see the concurrently running ActiveMQ registered JMX service. My application is not a locally selectable service.Code:<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"> <property name="locateExistingServerIfPossible" value="true"/> </bean> <!-- this bean must not be lazily initialized if the exporting is to happen --> <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false"> <property name="beans"> <map> <entry key="RPMController:name=testBean1" value-ref="testBean"/> </map> </property> <property name="server" ref="mbeanServer"/> </bean> <bean id="testBean" class="JmxTestBean"> <property name="name" value="TEST"/> <property name="age" value="100"/> </bean>
If I add -Dcom.sun.management.jmxremote to the command line that starts the application, I see the JMX service for the application as well as the ActiveMQ JMX service in JConsole. However, after selecting my application in JConsole the JmxTestBean is not found in the MBeans tab.
Can someone suggest why in the first case I'm not seeing even my application as a JMX service, and in the second case why I do not see the MBean I added?
Is there an option I can use that would reveal the issues during the Spring configuration step?


Reply With Quote