Announcement Announcement Module
Collapse
No announcement yet.
MBeans not appearing in Tomcat Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MBeans not appearing in Tomcat

    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:

    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>
    MBean Interface:

    Code:
    public interface ITestMgmtMBean
    {
      public String greet();
    }
    The actual class to be exposed:

    Code:
    public class TestMgmtMBean implements ITestMgmtMBean
    {
      public TestMgmtMBean()
      {
      }
    
      public String greet()
      {
        return "Hello!";
      }
    }

  • #2
    Just a small clarification on the above.

    I noticed that when I specify the JMX management port using -D and attach to it using the IP address and port I see my MBean and also the tomcat MBeans.

    Any idea why the process I am attaching to locally to the only MBeanServer I see (the tomcat Bootstrap loader) doesnt show my MBeans? Why is this different than what I see when I connect to the MBeanServer remotely?

    thanks.

    Comment

    Working...
    X