1 Reply Latest reply on Jun 9, 2011 8:29 AM by windigo

    How to register a MXBean (JBoss 6 final)

    windigo Newbie

      I want to use the new capabilities of MXBeans in java 1.6 to show List-attributes as javax.management.openmbean.CompositeData in the JMX-Console.

       

      If I name the interface TestMXBean.java and the implementation Test.java i got the following error while deploying my application: javax.management.NotCompliantMBeanException: Class does not expose a management interface: java.lang.Object

       

      After renaming the interface to TestMBean everything goes without error, BUT it's registered as a MBean and not as a MXBean. I'm also tried to annotate the interface with @MXBean, without success?

       

      So what should I do to deploy it as a MXBean?

       

       

      thx in advance

      Felix

        • 1. Re: How to register a MXBean (JBoss 6 final)
          windigo Newbie

          At the end i used the workaround decribed here.The code-snippet looks like this:

           

          Objectname objectName = new ObjectName("test", "type", Test.class.getSimpleName());
          MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
          final StandardMBean mxBean = new StandardMBean(new Test(), TestMXBean.class, true);
          mBeanServer.registerMBean(mxBean, objectName);
          

           

          The "true" in the StandardMBean-constructor is quite important beacause it marks the MBean as a MXBean.