Announcement Announcement Module
No announcement yet.
JConsole doesn't see Spring JMX server? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JConsole doesn't see Spring JMX server?

    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.

         <bean id="mbeanServer" class="">
            <property name="locateExistingServerIfPossible" value="true"/>
        <!-- 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">
                    <entry key="RPMController:name=testBean1" value-ref="testBean"/>
            <property name="server" ref="mbeanServer"/>
        <bean id="testBean" class="JmxTestBean">
            <property name="name" value="TEST"/>
            <property name="age" value="100"/>
    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.

    If I add 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?

  • #2
    JConsole Doesn't See Spring JMX Server?

    As documented in Platform Monitoring and Management Using JMX, the system property must be specified on the command-line when running a JMX-oriented application on the J2SE 5.0 platform. The requirement to specify this system property is no longer present with Java SE 6 thanks to the JMX Attach API added to Java SE 6. So, if you're running your Spring application in J2SE 5.0, the need for is normal.

    Once you have JConsole up, you should be looking for "RPMController" rather than "JmxTestBean" under your application.