0 Replies Latest reply on Oct 15, 2013 1:44 AM by Tomas Muller

    MXBeans - can't add MXBean description via standard java annotations after upgrade to JBoss v7.1.1

    Tomas Muller Newbie

      Hello,

       

      I'm within the migration process of our application from JBoss v5.1 to JBoss v7.1.1.

      After what I updated our MBeans codes to MXBeans I have a problem with adding descriptions (metadata) to our MXBean interfaces via standard java annotations.

      Same code was working fine in JBoss v5.1 and adds important description for MBean's operations/parameters to MBeanInfo.

      Such MBean description was then displayed in javax.management tools like JConsole or JMX Console so it is very useful.

       

      Here is a sample from our source codes:

      Sample MXBean Interface:

      @MXBean(true)

      @Description("Some nice description of whole MXBean")

      @Local

      public interface XYMXBean {

          @Description("Some nice description of MXBean operation")

          String performSomeExecution(@PName("nicePrameterName") String parameterName);

      }

       

      Sample MXBean Impl:

      @Singleton

      @Startup

      public class XYMBeanImpl implements XYMXBean {

          private static final String MXBEAN_OBJECT_NAME = "com.abc.def:service=XY";

          private static Log logger = LogFactory.getLog(XYMBeanImpl.class);

          private ObjectName objectName;

       

          @PostConstruct

          public void registerInJMX() {

          logger.debug("Registering MXBean: " + MXBEAN_OBJECT_NAME);

          this.objectName = MBeanHelper.registerInJMX(this, MXBEAN_OBJECT_NAME);

          }

       

          @PreDestroy

          public void unregisterFromJMX() {

          logger.debug("Unregistering MXBean: " + objectName.getCanonicalName());

          MBeanHelper.unregisterFromJMX(objectName);

          }


          @Override

          public String performSomeExecution(String parameterName) {

           // do some business logic

          }

      }

       

      Notes:

      1. MXBeans are correctly registered in MBean Server, I can see them and I can invoke their operations successfully
      2. @PName is very similar to @Description, it is different only with @Target({ElementType.PARAMETER}).
      3. In JBoss v5.1 we defined MBeans via org.jboss.ejb3.annotation.Service, but since this annotation was removed, I migrated the codes to @MXBean and EJB3.1 as described in my sample code.


      Such @Description and @PName annotations were working in JBoss v5.1, but now in JBoss v7.1 these annotations doesn't fill MBeanInfo with provided description content.

      Am I wrong with my code or is there some known limitation I'm not aware of?

       

      Thanks a lot for any hint.

       

      Tomas