0 Replies Latest reply on Aug 30, 2017 4:42 AM by Anatoliy Chernysh

    Loader constraint violation issue with javax/management/MBeanServer

    Anatoliy Chernysh Newbie

      Hi all,

       

      I'm trying to migrate application from JBoss-4.0.4.GA to wildfly-10.1.0.Final. I have an issue with JMX.

       

      During the start-up of application, I'm getting the following:

      10:58:02,689 WARN  [org.jboss.modules] (ServerService Thread Pool -- 90) Failed to define class javax.management.MBeanServer in Module "com.xor.genesis:main" from local module loader @1c2c22f3 (finder: local module finder @18e8568 (roots: /home/user/wildfly-10.1.0.Final/modules,/home/user/wildfly-10.1.0.Final/modules/system/layers/base)): java.lang.LinkageError: Failed to link javax/management/MBeanServer (Module "com.xor.genesis:main" from local module loader @1c2c22f3 (finder: local module finder @18e8568 (roots: /home/user/wildfly-10.1.0.Final/modules,/home/user/wildfly-10.1.0.Final/modules/system/layers/base))): loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/management/MBeanServer"

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

          at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)

          at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)

          at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)

          at org.jboss.modules.Module.loadModuleClass(Module.java:606)

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)

          at com.xor.genesis.core.jmx.framework.ApplicationMBeanManager.registerMBean(ApplicationMBeanManager.java:37)

          at com.xor.genesis.cgo.listeners.CGOApplicationListener.registerApplicationLogger(CGOApplicationListener.java:161)

          at com.xor.genesis.cgo.listeners.CGOApplicationListener.initMBeans(CGOApplicationListener.java:112)

          at com.xor.genesis.cgo.listeners.CGOApplicationListener.contextInitialized(CGOApplicationListener.java:59)

          at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)

          at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:200)

          at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:171)

          at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)

          at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSeupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:234)

          at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)

          at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)

          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

          at java.util.concurrent.FutureTask.run(FutureTask.java:266)

          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:748)

          at org.jboss.threads.JBossThread.run(JBossThread.java:320)

       

       

      To be more precise in code level the following line is producing the exception above:

      MBeanServer server = java.lang.management.ManagementFactory.getPlatformMBeanServer();

       

      I created own module with list of needed jars. I didn't modify client libraries inside the wildfly.

       

      Do you have any ideas how I can manage this problem?

       

      Thanks,

      Anatoly