2 Replies Latest reply on Oct 29, 2010 12:27 PM by Kabir Khan

    MBeanServer and TCL for MBeans

    Kabir Khan Master

      I have updated the MBeanServerService to use an MBeanBuilder to create the TcclMBeanServer since when trying out org.jboss.mx:jboss-mbeanserver, I was seeing errors like this:
      Caused by: javax.management.JMRuntimeException: Failed to load MBeanServerBuilder class org.jboss.as.jmx.tcl.TcclMBeanServerBuilder: java.lang.ClassNotFoundException: org.jboss.as.jmx.tcl.TcclMBeanServerBuilder from [Module "module:org.jboss.as.transactions:main" from default]
      at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:480) [:1.6.0_22]
      at javax.management.MBeanServerFactory.getNewMBeanServerBuilder(MBeanServerFactory.java:511) [:1.6.0_22]
      at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:298) [:1.6.0_22]
      at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:213) [:1.6.0_22]
      at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:174) [:1.6.0_22]
      at sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:302) [:1.6.0_22]
      at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:504) [:1.6.0_22]
      at com.arjuna.ats.arjuna.tools.osb.util.JMXServer.getServer(JMXServer.java:88)
      at com.arjuna.ats.arjuna.tools.osb.util.JMXServer.registerMBean(JMXServer.java:105)
      at com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBean.register(ObjStoreBean.java:136)
      at com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBean.getObjectStoreBrowserBean(ObjStoreBean.java:83)
      at com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBean.getObjectStoreBrowserBean(ObjStoreBean.java:73)
      at org.jboss.as.txn.TransactionManagerService.start(TransactionManagerService.java:144)
      ... 4 more
      Caused by: java.lang.ClassNotFoundException: org.jboss.as.jmx.tcl.TcclMBeanServerBuilder from [Module "module:org.jboss.as.transactions:main" from default]
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:194) [:1.0.0.Beta8]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:270) [:1.0.0.Beta8]
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:52) [:1.0.0.Beta8]
      at javax.management.MBeanServerFactory.loadBuilderClass(MBeanServerFactory.java:423) [:1.6.0_22]
      at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:465) [:1.6.0_22]
      ... 16 more
      So to make sure that all MBeans get the intended TCCL behaviour this is now using a builder initialized by MBeanServerService. Services, like the TransactionManagerService which internally in the arjuna code does not use an injected MBeanServer need their module to import org.jboss.as.jmx.module and their service to depend on the MBeanServerService.

      I have updated the MBeanServerService to use an MBeanBuilder to create the TcclMBeanServer since when trying out org.jboss.mx:jboss-mbeanserver, I was seeing errors like this:

       

      Caused by: javax.management.JMRuntimeException: Failed to load MBeanServerBuilder class org.jboss.as.jmx.tcl.TcclMBeanServerBuilder: java.lang.ClassNotFoundException: org.jboss.as.jmx.tcl.TcclMBeanServerBuilder from [Module "module:org.jboss.as.transactions:main" from default]

      at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:480) [:1.6.0_22]

      at javax.management.MBeanServerFactory.getNewMBeanServerBuilder(MBeanServerFactory.java:511) [:1.6.0_22]

      at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:298) [:1.6.0_22]

      at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:213) [:1.6.0_22]

      at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:174) [:1.6.0_22]

      at sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:302) [:1.6.0_22]

      at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:504) [:1.6.0_22]

      at com.arjuna.ats.arjuna.tools.osb.util.JMXServer.getServer(JMXServer.java:88)

      at com.arjuna.ats.arjuna.tools.osb.util.JMXServer.registerMBean(JMXServer.java:105)

      at com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBean.register(ObjStoreBean.java:136)

      at com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBean.getObjectStoreBrowserBean(ObjStoreBean.java:83)

      at com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBean.getObjectStoreBrowserBean(ObjStoreBean.java:73)

      at org.jboss.as.txn.TransactionManagerService.start(TransactionManagerService.java:144)

      ... 4 more

      Caused by: java.lang.ClassNotFoundException: org.jboss.as.jmx.tcl.TcclMBeanServerBuilder from [Module "module:org.jboss.as.transactions:main" from default]

      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:194) [:1.0.0.Beta8]

      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:270) [:1.0.0.Beta8]

      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:52) [:1.0.0.Beta8]

      at javax.management.MBeanServerFactory.loadBuilderClass(MBeanServerFactory.java:423) [:1.6.0_22]

      at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:465) [:1.6.0_22]

      ... 16 more

       

      So to make sure that all MBeans get the intended TCCL behaviour this is now using a builder initialized by MBeanServerService. Services, like the TransactionManagerService which internally in the arjuna code does not use an injected MBeanServer need their module to import org.jboss.as.jmx.module and their service to depend on the MBeanServerService.

        • 1. Re: MBeanServer and TCL for MBeans
          Thomas Diesler Master

          Kabir,

           

          it seems that this fixes an issue in one place but has negative effect in other places.

           

          We have could like this

           

             /**
              * Find or create the MBeanServer
              */
             public static MBeanServer findOrCreateMBeanServer()
             {
                MBeanServer mbeanServer = null;
                ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
                if (serverArr.size() > 1)
                   log.warn("Multiple MBeanServer instances: " + serverArr);
                if (serverArr.size() > 0)
                   mbeanServer = serverArr.get(0);
                if (mbeanServer == null)
                {
                   log.debug("No MBeanServer, create one ...");
                   mbeanServer = MBeanServerFactory.createMBeanServer();
                }
                return mbeanServer;
             }

           

           

          which now does not work any more.

           

          I suppose there should only be one MBeanServer in AS7 that all components share and that the jsr160 connector connects to. The code above also comes from third party that does not have access to the MBeanServerService

          • 2. Re: MBeanServer and TCL for MBeans
            Kabir Khan Master

            As long as your service is started after the MBeanServerService the same MBeanServer should get picked up if you do MBSF.getPlatformMBeanServer() (as noted in the stacktrace above) or MBSF.createMBeanServer(). This is the same MBeanServer as used by the JSR-160 connector.

             

            The idea is that MBeanServerService initialises all this, so if you are having issues have you put in the dependencies I mentioned?