Announcement Announcement Module
Collapse
No announcement yet.
JMX on Tomcat Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JMX on Tomcat

    Using JConsole to monitor Tomcat...works fine. But I can't seen any of my beans (maybe I don't know where to look). I'd like, at first anyway, to see all my Spring beans, which I thought was the default. Here's my relevant applicationContext.xml (I'm using Tomcat's MBeanServer):

    Code:
       	<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false">
        	<property name="autodetect" value="true"/>
        	<property name="autodetectModeName" value="AUTODETECT_ALL"/>
    	</bean>
    Mbean info in my logs (if I use Java 5 instead of 6, I get MXBean ClassDefNotFound, don't know if it's just attempting to detect Java 6 features), I never see info about exporting of any mbeans:
    Code:
    2008-12-18 10:25:08,301 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Getting BeanInfo for class [org.springframework.jmx.export.MBeanExporter]
    2008-12-18 10:25:08,303 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Caching PropertyDescriptors for class [org.springframework.jmx.export.MBeanExporter]
    2008-12-18 10:25:08,303 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'assembler' of type [org.springframework.jmx.export.assembler.MBeanInfoAssembler]
    2008-12-18 10:25:08,303 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'autodetect' of type [boolean]
    2008-12-18 10:25:08,303 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'autodetectMode' of type [int]
    2008-12-18 10:25:08,303 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'autodetectModeName' of type [java.lang.String]
    2008-12-18 10:25:08,303 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'beanClassLoader' of type [java.lang.ClassLoader]
    2008-12-18 10:25:08,303 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'beanFactory' of type [org.springframework.beans.factory.BeanFactory]
    2008-12-18 10:25:08,303 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'beans' of type [java.util.Map]
    2008-12-18 10:25:08,303 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'class' of type [java.lang.Class]
    2008-12-18 10:25:08,304 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'ensureUniqueRuntimeObjectNames' of type [boolean]
    2008-12-18 10:25:08,304 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'excludedBeans' of type [[Ljava.lang.String;]
    2008-12-18 10:25:08,304 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'exposeManagedResourceClassLoader' of type [boolean]
    2008-12-18 10:25:08,304 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'listeners' of type [[Lorg.springframework.jmx.export.MBeanExporterListener;]
    2008-12-18 10:25:08,304 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'namingStrategy' of type [org.springframework.jmx.export.naming.ObjectNamingStrategy]
    2008-12-18 10:25:08,304 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'notificationListenerMappings' of type [java.util.Map]
    2008-12-18 10:25:08,304 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'notificationListeners' of type [[Lorg.springframework.jmx.export.NotificationListenerBean;]
    2008-12-18 10:25:08,304 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'registrationBehavior' of type [int]
    2008-12-18 10:25:08,304 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'registrationBehaviorName' of type [java.lang.String]
    2008-12-18 10:25:08,304 [main] DEBUG org.springframework.beans.CachedIntrospectionResults - Found bean property 'server' of type [javax.management.MBeanServer]
    ....
    2008-12-18 10:25:08,305 [main] INFO  org.springframework.jmx.export.MBeanExporter - Registering beans for JMX exposure on startup
    2008-12-18 10:25:08,305 [main] DEBUG org.springframework.jmx.export.MBeanExporter - Autodetecting user-defined JMX MBeans
    ....
    Any ideas?

  • #2
    For clarification:
    When I explicitly list the beans property, of course, it works.
    Code:
    		<property name="beans">
    			<map>
    				<entry key="bean:name=User" value-ref="user" />
    			</map>
    		</property>
    What I want is Chapter 20. JMX:
    The automatic registration of any Spring bean as a JMX MBean

    Comment


    • #3
      Got a PM asking about this thread. Here's my follow up:

      The documentation doesn't mean quite what I thought. There is other required configuration but not as extensively as raw JMX/MBean. My configuration is now:

      applicationContext.xml
      Code:
      <context:mbean-export registration="ignoreExisting"/>
      MBeanIwantToSee.java
      Code:
      @ManagedResource
      class MBeanIwantToSee {
        String varIwantToSee;
      
        @ManagedAttribute
        public String getVarIwantToSee() {
          return varIwantToSee;
        }
      }
      I think it would be awesome to be able to automatically export all beans as MBeans with the addition of a line of XML, but that doesn't seem to be how it is. Now, I haven't dug into the Spring source code to verify that there isn't any way, so a grain of salt.

      Comment

      Working...
      X