JBOSS EAP6.4 中的 NoClassDefFoundError
NoClassDefFoundError in JBOSS EAP6.4
当我在 JBOSS EAP6.4 中部署我的 war 时,尽管我的类路径中有 jackson-mapper-asl.1.9.2.jar 并设置为读取,但我仍然遇到以下错误在部署结构中
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="deploy" />
<module name="org.codehaus.jackson.jackson-mapper-asl" />
</dependencies>
</deployment>
</jboss-deployment-structure>
下面是日志栈
Thread-11733 2016-09-12 06:12:10,169 | WARN | session= | user= | org.hornetq.jms.client | HQ122001: Unhandled exception thrown from onMessage: java.lang.RuntimeException: java.lang.LinkageError: Failed to link com/sun/jersey/api/json/JSONWithPadding (Module "deploy:main" from local module loader @ed17bee (finder: local module finder @2a33fae0 (roots: /vend/hybris/jboss/jboss-eap-6.4/modules,/vend/hybris/jboss/jboss-eap-6.4/modules/system/layers/base/.overlays/BZ1281963,/vend/hybris/jboss/jboss-eap-6.4/modules/system/layers/base,/vend/hybris/OTMM16/Media-Manager/mediamanagement,/vend/hybris/OTMM16/Media-Manager/mediamanagement)))
at com.artesia.event.services.EventListenerManager$EventListenerWrapper.onMessage(EventListenerManager.java:101)
at org.hornetq.jms.client.JMSMessageListenerWrapper.onMessage(JMSMessageListenerWrapper.java:98)
at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1117)
at org.hornetq.core.client.impl.ClientConsumerImpl.access0(ClientConsumerImpl.java:57)
at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1252)
at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor.run(OrderedExecutorFactory.java:105)
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.LinkageError: Failed to link com/sun/jersey/api/json/JSONWithPadding (Module "deploy:main" from local module loader @ed17bee (finder: local module finder @2a33fae0 (roots: /vend/hybris/jboss/jboss-eap-6.4/modules,/vend/hybris/jboss/jboss-eap-6.4/modules/system/layers/base/.overlays/BZ1281963,/vend/hybris/jboss/jboss-eap-6.4/modules/system/layers/base,/vend/hybris/OTMM16/Media-Manager/mediamanagement,/vend/hybris/OTMM16/Media-Manager/mediamanagement)))
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:487)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:92)
at org.jboss.modules.Module.loadModuleClass(Module.java:568)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at com.sun.jersey.core.reflection.MethodList.getAllDeclaredMethods(MethodList.java:70)
at com.sun.jersey.core.reflection.MethodList.<init>(MethodList.java:64)
at com.sun.jersey.core.spi.component.ComponentConstructor.getPostConstructMethods(ComponentConstructor.java:132)
at com.sun.jersey.core.spi.component.ComponentConstructor.<init>(ComponentConstructor.java:124)
at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:165)
at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:137)
at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:283)
at com.sun.jersey.core.spi.component.ProviderServices.getServices(ProviderServices.java:163)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.initWriters(MessageBodyFactory.java:207)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:163)
at com.sun.jersey.api.client.Client.init(Client.java:343)
at com.sun.jersey.api.client.Client.access[=12=]0(Client.java:119)
at com.sun.jersey.api.client.Client.f(Client.java:192)
at com.sun.jersey.api.client.Client.f(Client.java:188)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.api.client.Client.<init>(Client.java:188)
at com.sun.jersey.api.client.Client.<init>(Client.java:171)
at com.microsoft.windowsazure.core.pipeline.jersey.Exports.create(Exports.java:81)
at com.microsoft.windowsazure.core.pipeline.jersey.Exports.create(Exports.java:65)
at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:200)
at com.microsoft.windowsazure.core.DefaultBuilder.create(DefaultBuilder.java:138)
at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:200)
at com.microsoft.windowsazure.core.DefaultBuilder.create(DefaultBuilder.java:138)
at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:200)
at com.microsoft.windowsazure.Configuration.create(Configuration.java:119)
at com.microsoft.windowsazure.services.media.MediaService.create(MediaService.java:47)
at com.example.AzureAPIProxy.getMediaService(AzureAPIProxy.java:250)
at com.artesia.event.services.EventListenerManager$EventListenerWrapper.onMessage(EventListenerManager.java:85)
... 8 more
Caused by: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/JsonSerializableWithType
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482)
... 51 more
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonSerializableWithType from [Module "deploy:main" from local module loader @ed17bee (finder: local module finder @2a33fae0 (roots: /vend/hybris/jboss/jboss-eap-6.4/modules,/vend/hybris/jboss/jboss-eap-6.4/modules/system/layers/base/.overlays/BZ1281963,/vend/hybris/jboss/jboss-eap-6.4/modules/system/layers/base,/vend/hybris/OTMM16/Media-Manager/mediamanagement,/vend/hybris/OTMM16/Media-Manager/mediamanagement))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134)
... 55 more
如何解决?
似乎 "deploy" 文件夹可能不在模块下的正确文件夹树级别。我还建议不要将其命名为 "deploy" 文件夹,以避免与实际部署混淆。
如果你想让它像你引用的那样工作,你的文件夹结构应该是这样的。
vend/hybris/jboss/jboss-eap-6.4/modules/deploy/main
。在此文件夹下,您应该有一个 module.xml
文件和对必要 jars 的引用以及 jars 本身。
我已通过将 jar 添加到我的部署模块来解决此问题。看看是否有其他方法可以解决这个问题,目前添加 jar 到部署模块已经解决了这个问题。
当我在 JBOSS EAP6.4 中部署我的 war 时,尽管我的类路径中有 jackson-mapper-asl.1.9.2.jar 并设置为读取,但我仍然遇到以下错误在部署结构中
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="deploy" />
<module name="org.codehaus.jackson.jackson-mapper-asl" />
</dependencies>
</deployment>
</jboss-deployment-structure>
下面是日志栈
Thread-11733 2016-09-12 06:12:10,169 | WARN | session= | user= | org.hornetq.jms.client | HQ122001: Unhandled exception thrown from onMessage: java.lang.RuntimeException: java.lang.LinkageError: Failed to link com/sun/jersey/api/json/JSONWithPadding (Module "deploy:main" from local module loader @ed17bee (finder: local module finder @2a33fae0 (roots: /vend/hybris/jboss/jboss-eap-6.4/modules,/vend/hybris/jboss/jboss-eap-6.4/modules/system/layers/base/.overlays/BZ1281963,/vend/hybris/jboss/jboss-eap-6.4/modules/system/layers/base,/vend/hybris/OTMM16/Media-Manager/mediamanagement,/vend/hybris/OTMM16/Media-Manager/mediamanagement)))
at com.artesia.event.services.EventListenerManager$EventListenerWrapper.onMessage(EventListenerManager.java:101)
at org.hornetq.jms.client.JMSMessageListenerWrapper.onMessage(JMSMessageListenerWrapper.java:98)
at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1117)
at org.hornetq.core.client.impl.ClientConsumerImpl.access0(ClientConsumerImpl.java:57)
at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1252)
at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor.run(OrderedExecutorFactory.java:105)
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.LinkageError: Failed to link com/sun/jersey/api/json/JSONWithPadding (Module "deploy:main" from local module loader @ed17bee (finder: local module finder @2a33fae0 (roots: /vend/hybris/jboss/jboss-eap-6.4/modules,/vend/hybris/jboss/jboss-eap-6.4/modules/system/layers/base/.overlays/BZ1281963,/vend/hybris/jboss/jboss-eap-6.4/modules/system/layers/base,/vend/hybris/OTMM16/Media-Manager/mediamanagement,/vend/hybris/OTMM16/Media-Manager/mediamanagement)))
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:487)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:92)
at org.jboss.modules.Module.loadModuleClass(Module.java:568)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at com.sun.jersey.core.reflection.MethodList.getAllDeclaredMethods(MethodList.java:70)
at com.sun.jersey.core.reflection.MethodList.<init>(MethodList.java:64)
at com.sun.jersey.core.spi.component.ComponentConstructor.getPostConstructMethods(ComponentConstructor.java:132)
at com.sun.jersey.core.spi.component.ComponentConstructor.<init>(ComponentConstructor.java:124)
at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:165)
at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:137)
at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:283)
at com.sun.jersey.core.spi.component.ProviderServices.getServices(ProviderServices.java:163)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.initWriters(MessageBodyFactory.java:207)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:163)
at com.sun.jersey.api.client.Client.init(Client.java:343)
at com.sun.jersey.api.client.Client.access[=12=]0(Client.java:119)
at com.sun.jersey.api.client.Client.f(Client.java:192)
at com.sun.jersey.api.client.Client.f(Client.java:188)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.api.client.Client.<init>(Client.java:188)
at com.sun.jersey.api.client.Client.<init>(Client.java:171)
at com.microsoft.windowsazure.core.pipeline.jersey.Exports.create(Exports.java:81)
at com.microsoft.windowsazure.core.pipeline.jersey.Exports.create(Exports.java:65)
at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:200)
at com.microsoft.windowsazure.core.DefaultBuilder.create(DefaultBuilder.java:138)
at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:200)
at com.microsoft.windowsazure.core.DefaultBuilder.create(DefaultBuilder.java:138)
at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:200)
at com.microsoft.windowsazure.Configuration.create(Configuration.java:119)
at com.microsoft.windowsazure.services.media.MediaService.create(MediaService.java:47)
at com.example.AzureAPIProxy.getMediaService(AzureAPIProxy.java:250)
at com.artesia.event.services.EventListenerManager$EventListenerWrapper.onMessage(EventListenerManager.java:85)
... 8 more
Caused by: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/JsonSerializableWithType
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482)
... 51 more
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonSerializableWithType from [Module "deploy:main" from local module loader @ed17bee (finder: local module finder @2a33fae0 (roots: /vend/hybris/jboss/jboss-eap-6.4/modules,/vend/hybris/jboss/jboss-eap-6.4/modules/system/layers/base/.overlays/BZ1281963,/vend/hybris/jboss/jboss-eap-6.4/modules/system/layers/base,/vend/hybris/OTMM16/Media-Manager/mediamanagement,/vend/hybris/OTMM16/Media-Manager/mediamanagement))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134)
... 55 more
如何解决?
似乎 "deploy" 文件夹可能不在模块下的正确文件夹树级别。我还建议不要将其命名为 "deploy" 文件夹,以避免与实际部署混淆。
如果你想让它像你引用的那样工作,你的文件夹结构应该是这样的。
vend/hybris/jboss/jboss-eap-6.4/modules/deploy/main
。在此文件夹下,您应该有一个 module.xml
文件和对必要 jars 的引用以及 jars 本身。
我已通过将 jar 添加到我的部署模块来解决此问题。看看是否有其他方法可以解决这个问题,目前添加 jar 到部署模块已经解决了这个问题。