gpt4 book ai didi

java - jboss 无法定义类 javax.jms.JMSException

转载 作者:行者123 更新时间:2023-11-30 02:35:12 25 4
gpt4 key购买 nike

我是 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

从研究来看,似乎是依赖问题,只有接口(interface)。

<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这样的jar。我可以在 JBoss 运行时下找到一个 jboss-ejb-api_3.2_spec-1.0.0.Final-redhat-1.jar 。但它不包含 javax.jms.* 上的任何内容。

我还查看了类加载。使用 jboss-deployment-struction.xml 修补了ear文件,其中包含消除双重类加载的内容。

<jboss-deployment-structure> 
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
</jboss-deployment-structure>

还是不行。有什么建议吗?

最佳答案

那个javax.javaee-api.6.0 Maven 依赖项有一个 well documented问题 - 它所需的任何实现类的字节代码已被剥离,导致 java.lang.ClassFormatError .

您看到此情况的原因是因为即使您的 dependency<scope>provided</scope> ,此 jar 的副本已泄漏到您的应用程序部署中的某处。你需要摆脱它。

完成此操作后,您可以将依赖项升级到 <version>7.0</version>它没有这个问题(这通常只是依赖它的单元测试的问题)。

关于java - jboss 无法定义类 javax.jms.JMSException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43285090/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com