Hi,
I have tried to follow the instructions of Chapter 20 (section 20.2) where I have created a simple class (below) and tried to pass it to the MBeanExporter. I want my MBean to be exposed Tomcat's MBeanServer, so as instructed in Section 20.2.1, since an MBeanServer already exists I only need to specify the exporter.
When I start up the application, in the logs I see no exceptions and I see these lines, which seem to indicate that it is doing something JMX related:
23-Jan-2009 20:42:03 org.springframework.jmx.export.MBeanExporter afterPropertiesSet
INFO: Registering beans for JMX exposure on startup
23-Jan-2009 20:42:03 org.springframework.jmx.export.MBeanExporter registerBeanInstance
INFO: Located managed bean 'bean:name=testMgmt1': registering with JMX server as MBean [bean:name=testMgmt1]
However, when I start JConsole and attach to the Tomcat Bootstrap process, I only find the default MBean hierarchy (JMImplementation, com.sun.management, java.lang and java.util.logging). I couldnt find my MBean or any Spring related bean anywhere. Am I doing something completely wrong?
Environment: Win XP SP2, Tomcat 6.0.18, JDK 1.6.0_07, Spring 2.5.5
Spring Application Context:
MBean Interface:Code:<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false"> <property name="beans"> <map> <entry key="bean:name=testMgmt1" value-ref="testMgmt"/> </map> </property> </bean> <bean id="testMgmt" class="com.test.management.TestMgmtMBean"> </bean>
The actual class to be exposed:Code:public interface ITestMgmtMBean { public String greet(); }
Code:public class TestMgmtMBean implements ITestMgmtMBean { public TestMgmtMBean() { } public String greet() { return "Hello!"; } }


Reply With Quote
