我是JBoss的新手。我有一个Ear文件在WAS上工作正常。但是当我在JBoss EAP 7.1上尝试它时,它给了我以下错误。
14:15:18,640 WARN [org.jboss.modules] (MSC service thread 1-6) Failed to define class javax.jms.JMSException in Module "deployment.xxx.ear.yyy.war:mai
n" from Service Module Loader: java.lang.ClassFormatError: Failed to link javax/jms/JMSException (Module "xxx.ear.yyy.war:main" from Service
Module Loader): Absent Code attribute in method that is not native or abstract in class file javax/jms/JMSException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
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:605)
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 java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.jboss.as.jsf.deployment.JSFManagedBeanProcessor.deploy(JSFManagedBeanProcessor.java:100)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
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(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
14:15:18,640 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.subunit."xxx.ear"."yyy.war
".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."xxx.ear"."yyy.war".POST_MODULE: WFLYSRV0153: Failed to process
phase POST_MODULE of subdeployment "yyy.war" of deployment "xxx.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
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(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassFormatError: Failed to link javax/jms/JMSException (Module "deployment.xxx.ear.yyy.war:main" from Service Module Loader): Abs
ent Code attribute in method that is not native or abstract in class file javax/jms/JMSException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
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:605)
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 java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.jboss.as.jsf.deployment.JSFManagedBeanProcessor.deploy(JSFManagedBeanProcessor.java:100)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
从研究来看,似乎是依赖的问题,它只有接口。
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
所以我改为
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0-5</version>
</dependency>
但没有运气。我也在寻找像j2ee.jar这样的罐子。我可以在JBoss运行时找到一个jboss-ejb-api_3.2_spec-1.0.0.Final-redhat-1.jar。但它并没有在javax.jms上包含任何内容。*。
我还看了课程加载。使用jboss-deployment-structure.xml修补ear文件,内容可以消除双类加载。
<jboss-deployment-structure>
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
</jboss-deployment-structure>
仍然无法运作。有什么建议吗?
答案 0 :(得分:2)
javax.javaee-api.6.0
maven依赖项有一个well documented问题 - 它所需的任何实现类的字节代码都被剥离,导致java.lang.ClassFormatError
。
您看到这个的原因是因为即使您的dependency
说<scope>provided</scope>
,此jar的副本也已泄漏到您的应用程序部署中。你需要摆脱它。
完成此操作后,您可以将依赖关系升级到<version>7.0</version>
,但没有此问题(这通常只是依赖于它的单元测试的问题)。