2 Replies Latest reply on Mar 9, 2009 11:25 AM by Arnaud Aubert

    Spring JMX beans not showing up in Jboss page

    Madhan Lakshmanan Newbie

      Hello team,

      I'm new to Jboss-Spring-JMX. Any help will be appreciated immensely.
      Thanks,
      Maddy

      I'm using Spring 2.5.x and Java 1.6 and JBoss 4.x

      public interface EnrollmentGroupLogic {
       Long getRANK_EXPIRY_TIME();
       void setRANK_EXPIRY_TIME(Long RANK_EXPIRY_TIME);
      }


      The code of the implementing class is
      @Service
      @ManagedResource(objectName = "spring:name=enrollmentGroup", description = "Enrollment Group")
      public class EnrollmentGroupLogicImpl implements EnrollmentGroupLogic{
      
       public Long RANK_EXPIRY_TIME = 60000L;
      
       @ManagedAttribute
       public Long getRANK_EXPIRY_TIME() {
       return RANK_EXPIRY_TIME;
       }
      
       @ManagedAttribute
       public void setRANK_EXPIRY_TIME(Long RANK_EXPIRY_TIME) {
       this.RANK_EXPIRY_TIME = RANK_EXPIRY_TIME;
       }
      }

      My applicationcontext-xml file contains
      <bean
       id="mbeanServer"
       class="org.springframework.jmx.support.MBeanServerFactoryBean">
       <property
       name="locateExistingServerIfPossible"
       value="true"/>
       </bean>
      
      
       <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false">
       <property name="assembler" ref="assembler"/>
       <property name="autodetect" value="true"/>
       <property name="namingStrategy" ref="jmxnamingstrategy"/>
       <property name="server" ref="mbeanServer"/>
       </bean>
       <bean id="jmxnamingstrategy"
       class="org.springframework.jmx.export.naming.MetadataNamingStrategy">
       <property name="attributeSource" ref="attributeSource"/>
       </bean>
       <bean id="attributeSource"
       class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource"/>
      
       <bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
       <property name="attributeSource" ref="attributeSource"/>
       </bean>


      I've also added the following in my run.bat

      set JAVA_OPTS=%JAVA_OPTS% -Djavax.management.builder.initial=org.jboss.system .server.jmx.MBeanServerBuilderImpl
      set JAVA_OPTS=%JAVA_OPTS% -Djboss.platform.mbeanserver
      set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote

      I'm seeing the following in the system console
      11:13:28,835 INFO [MBeanExporter] Registering beans for JMX exposure on startup
      11:13:28,865 INFO [ContextLoader] Root WebApplicationContext: initialization completed in 41371 ms


      I'm seeing the following in log file
      2009-02-11 11:45:38,568 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'jmxnamingstrategy'
      2009-02-11 11:45:38,568 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'jmxnamingstrategy'
      2009-02-11 11:45:38,568 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0'
      2009-02-11 11:45:38,568 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#1'
      2009-02-11 11:45:38,568 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#2'
      2009-02-11 11:45:38,568 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#3'
      2009-02-11 11:45:38,568 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#4'
      2009-02-11 11:45:38,568 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#5'
      2009-02-11 11:45:38,578 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'jmxnamingstrategy' to allow for resolving potential circular references
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'attributeSource'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Invoking afterPropertiesSet() on bean with name 'jmxnamingstrategy'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#1'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#2'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#3'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#4'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#5'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#1'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#2'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#3'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#4'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#5'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'jmxnamingstrategy'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'mbeanServer'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#1'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#2'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#3'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#4'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#5'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#1'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#2'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#3'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#4'
      2009-02-11 11:45:38,588 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#5'
      2009-02-11 11:45:38,648 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Invoking afterPropertiesSet() on bean with name 'exporter'
      2009-02-11 11:45:38,648 INFO [org.springframework.jmx.export.MBeanExporter] Registering beans for JMX exposure on startup
      2009-02-11 11:45:38,648 DEBUG [org.springframework.jmx.export.MBeanExporter] Autodetecting user-defined JMX MBeans