2017-04-07 44 views
1

我是JBoss的新手。 WAS上有一個Ear文件可以工作。但是當我在JBoss EAP 7.1上嘗試時,它給了我下面的錯誤。jboss未能定義類javax.jms.JMSException

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這樣的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天的JBoss EAP 7.1 Alpha版嗎? –

+0

更改爲EAP 7.0。同樣的錯誤。 – rickcoup

回答

2

javax.javaee-api.6.0 maven依賴關係有一個單一的well documented問題 - 它需要的任何實現類的字節代碼已被剝離,導致java.lang.ClassFormatError

您看到這種情況的原因是因爲即使您的dependency<scope>provided</scope>,此jar的副本泄漏到您的應用程序部署的某處。你需要擺脫它。

完成此操作後,您可以將依賴關係升級到<version>7.0</version>,這樣不存在此問題(對於依賴它的單元測試,這通常只是一個問題)。

+0

更改爲 的javax 的JavaEE-API 7.0 固定它。 – rickcoup