7 Replies Latest reply on Jan 22, 2018 11:54 AM by hao1st

    : javax.management.ReflectionException: The MBean class could not be loaded by the default loader repository

    mgacamedica

      We are migrating JBOSS from 4.0.3SP1 to Wildfly 10.1.0.  Our applications are bundled in separate sars which contain standard as well as Dynamic beans.

       

      We are getting "javax.management.ReflectionException: The MBean class could not be loaded by the default loader repository" exception caused by  "java.lang.ClassNotFoundException: com.xxx.ccr.common.adapter.PEAdapterLCM". Stack Trace is added in the end. PEAdapter class is a Dynamic MBean and is present in one of the jars in the common modules under /opt/coreservices/wildfly-10.1.0.Final/modules.

       

      We are using standalone-full.xml to start our Wildfly  instance  (ccr2)

      [root@puiqr710dev08 CCR]# ps -eaf|grep ccr2

      xxxiq  28948  7529 21 15:17 ?        00:07:10 /opt/Xxx/CCR/jre/bin/java -verbose:class -Ddss.port=31002 -DCONTAINER_UUID=14132c5860baba870160bac5d84e084a -Dlcm.host= xxx.xxxx.xxx.xxx -server -XX:NewRatio=1 -XX:+UseG1GC -XX:+UseLargePages -XX:MaxGCPauseMillis=1000 -XX:GCTimeRatio=10 -XX:+DisableExplicitGC -Dsun.nio.ch.disableSystemWideOverlappingFileLockCheck=true -Ddss.thread_pool_size=24 -Xss250k -Xms256m -Xmx4096m -DUSE_DELAY1=60000 -DUSE_DELAY2=60000 -Dlog4j.configuration=file:/opt/Xxx/CCR/appserver/jboss-boot.log4j.properties -DLOG_FILE_PREFIX=DataProcessingJBoss_puiqdevdads07 -Ddss.message_lifetime=180 -Djava.awt.headless=true -Dorg.jboss.logging.Log4jService.catchSystemErr=false -classpath /opt/Xxx/CCR/jre/lib/tools.jar -jar /opt/coreservices/wildfly-10.1.0.Final/jboss-modules.jar -mp /opt/coreservices/wildfly-10.1.0.Final/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=/opt/coreservices/wildfly-10.1.0.Final -Djboss.server.base.dir=/opt/coreservices/wildfly-10.1.0.Final/ccr2 -Djboss.bind.address=xxx.xxxx.xxx.xxx -Djboss.bind.address.management= xxx.xxxx.xxx.xxx -c standalone-full.xml

       

      ·         We have four sars that are deployed in this instance.  All sars are deployed successfully.

      ·         We have packaged our sars as follows:

      --lib (contains all jars)

      --META-INF

          |--jboss-deployment-structure.xml

          |--jboss-service.xml

       

      ·         Each sar contains some standard MBeans and few Dynamic MBeans.

      ·         We have defined standard MBeans in jboss-services.xml. They are created properly and can be seen in JConsole.

      ·         We can NOT include definition of Dynamic MBeans  in jboss-service.xml as their name is constructed at runtime.

      ·         PEAdapterLCM for which we are getting ClassNotFoundException is a dynamic bean and we are getting this error for all Dynamic MBeans.

      ·         We have created modules for all common jars that were part of “server/lib” folder in JBOSS 4.0.3SP1.

        

      We tried following to fix this error but no luck:

      1) packaged contents of all sars in one single sar and deployed it.

      2) Added a global module entry in standalone-full.xml which contents dynamic MBeans.

      3) Added definition of dynamic MBean in jboss-service.xml (just to see if this makes any difference). With this change, we were able to see the MBean in JConsole.

       

      So what should be done to fix this error.  Are there any changes in how to implement and deploy Dymanic MBeans in Wildfly?

       

      Is there any way in Wildfly we can explicitly mention the MBean server class while starting the Wildfly  as it was done in JBOSS 4.0.3SP1 using "-Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl -Djboss.platform.mbeanserver -Dcom.sun.management.jmxremote"

       

       

      Here is complete stack trace:

       

      ^[[0m^[[31m15:01:30,324 ERROR [com.xxx.coreservice.lifecycle.jmx.PEController] (MSC service thread 1-6) Exception in PEController:PEControllerJmxJBossService start for peID 14132c58609742440160974fe69307e0: : javax.management.ReflectionException: The MBean class could not be loaded by the default loader repository

              at com.sun.jmx.mbeanserver.MBeanInstantiator.findClassWithDefaultLoaderRepository(MBeanInstantiator.java:104)

              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.createMBean(DefaultMBeanServerInterceptor.java:268)

              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.createMBean(DefaultMBeanServerInterceptor.java:206)

              at com.sun.jmx.mbeanserver.JmxMBeanServer.createMBean(JmxMBeanServer.java:326)

              at com.avaya.lifecycle.jmx.agent.PEControllerJmx._start(PEControllerJmx.java:55)

              at com.xxx.coreservice.lifecycle.jmx.PEController.start(PEController.java:397)

              at com.xxx.coreservice.lifecycle.jmx.PEController.startAll(PEController.java:314)

              at com.xxx.coreservice.lifecycle.jmx.PEController.startup(PEController.java:238)

              at com.xxx.coreservice.lifecycle.jmx.PEController.postRegister(PEController.java:700)

              at com.sun.jmx.mbeanserver.MBeanSupport.postRegister(MBeanSupport.java:182)

              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.postRegister(DefaultMBeanServerInterceptor.java:1024)

              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:974)

              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)

              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)

              at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)

              at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.registerMBean(PluggableMBeanServerImpl.java:1527)

              at org.jboss.as.jmx.PluggableMBeanServerImpl.registerMBean(PluggableMBeanServerImpl.java:871)

              at org.jboss.as.jmx.MBeanRegistrationService.start(MBeanRegistrationService.java:101)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

              at java.lang.Thread.run(Thread.java:745)

      Caused by: java.lang.ClassNotFoundException: com.xxx.ccr.common.adapter.PEAdapterLCM

              at com.sun.jmx.mbeanserver.ClassLoaderRepositorySupport.loadClass(ClassLoaderRepositorySupport.java:232)

      Thanks for help in advance.

      https://developer.jboss.org/discussion/create!input.jspa?containerType=14&containerID=2303&draftID=430843