3 Replies Latest reply on Jul 18, 2008 3:52 AM by martin_ulmschneider

    Spring JMX issues in JBoss

    krishh

      have defined these beans in my appContext.
      <bean id="exporter" class="org.springframework.jmx.export.MBeanExporte r" lazy-init="false">








      And in one of my spring beans, I have annotations
      @ManagedResource(objectName = "spring.ua:service=TimePeriodServiceExecutione r", description = "A sample JMX-managed bean")
      public class TimePeriodServiceImpl
      implements TimePeriodService{

      and a method
      @ManagedAttribute
      public List getAllResolutionsAsStrings()
      {

      When I build my ear, deploy it in Jboss, I am not able to see the auto detected managed bean in my JMXConsole. why?
      It appears when JBoss start the mbeans are registered. What do I need to do to make the mbeans visible on the JMXConsole.

      Thanks in advance"

        • 1. Re: Spring JMX issues in JBoss
          krishh

          repost: some of the bean definitions were lost when posted.
          I have defined these beans in my appContext.
          <bean id=mbeanServer class=org.springframework.jmx.support.MBeanServerFactoryBean>
          <!-- indicate to first look for a server -->
          <property name=locateExistingServerIfPossible value=true/>

          <bean id=exporter class=org.springframework.jmx.export.MBeanExporter lazy-init=false>
          <property name=server ref=mbeanServer/> <!-- refer to spring's factory comment out if using another jmx server agent-->
          <property name=assembler ref=assembler/>
          <property name=namingStrategy ref=namingStrategy/>
          <property name=autodetect value=true/>
          <property name=registrationBehaviorName value=REGISTRATION_IGNORE_EXISTING/>


          <bean id=jmxAttributeSource
          class=org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource/>

          <!-- will create management interface using annotation metadata -->
          <bean id=assembler
          class=org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler>
          <property name=attributeSource ref=jmxAttributeSource/>


          <!-- will pick up the ObjectName from the annotation -->
          <bean id=namingStrategy
          class=org.springframework.jmx.export.naming.MetadataNamingStrategy>
          <property name=attributeSource ref=jmxAttributeSource/>


          And in one of my spring beans, I have annotations
          @ManagedResource(objectName = "spring.ua:service=TimePeriodServiceExecutione r", description = "A sample JMX-managed bean")
          public class TimePeriodServiceImpl
          implements TimePeriodService{

          and a method
          @ManagedAttribute
          public List getAllResolutionsAsStrings()
          {

          When I build my ear, deploy it in Jboss, I am not able to see the auto detected managed bean in my JMXConsole. why?
          It appears when JBoss start the mbeans are registered. What do I need to do to make the mbeans visible on the JMXConsole.

          Thanks in advance

          • 2. Re: Spring JMX issues in JBoss
            martin_ulmschneider

            maybe you have more than one jmx server.
            try using mbeanserverlocater from jboss.

            <bean id="jmxExporter" class="org.springframework.jmx.export.MBeanExporter"
            lazy-init="false">

            <bean class="org.jboss.mx.util.MBeanServerLocator" factory-method="locateJBoss"/>

            • 3. Re: Spring JMX issues in JBoss
              martin_ulmschneider

              <bean id="jmxExporter"class="org.springframework.jmx.export.MBeanExporter"lazy-init="false">
              < property name="server">
              <bean class="org.jboss.mx.util.MBeanServerLocator" factory-method="locateJBoss"/>
              < /property>
              < /bean>