我試圖將應用程序從JBoss-4.0.4.GA遷移到wildfly-10.1.0.Final。我遇到了JMX的問題。javax/management/MBeanServer加載程序約束違規問題
在應用程序的啓動時,我發現了以下內容:
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/chaos1/wildfly-10.1.0.Final/modules,/home/chaos1/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(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.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)
要在代碼級更精確的下面的行是生產上述異常:
MBeanServer server = java.lang.management.ManagementFactory.getPlatformMBeanServer();
我創建自己的模塊與所需的罐子清單。我沒有修改野蠅內的客戶端庫。
你有什麼想法可以解決這個問題嗎?
感謝, 阿納託利
似乎與MBeanServer.class在類路徑中的存在重複項有關。 – chaos