【发布时间】:2015-03-06 23:36:17
【问题描述】:
我有这个项目https://github.com/AndreaCatania/libreria
它有 3 个模块 "deweb" "decore" "libreriaEar"
模块 libreriaEar 使用 deweb 和 dere 模块创建 EAR 存档 我尝试在模块“decore”中使用 Hibernate,但 maven 没有将依赖项导入“decore”模块,我收到 NoClassFoundException 错误。
如果我检查 ear 存档,我会在其中找到所有依赖项,而不是在模块“decore”中。
生成的 EAR 存档
生成的核心模块(EJB) 怎么了?
编辑 1
主 pom:https://github.com/AndreaCatania/libreria/blob/master/pom.xml
编辑 2
当我将项目部署到 WildFly AS 时出现此错误。
[0m[31m16:01:10,654 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-9) MSC000001: Failed to start service jboss.deployment.subunit."libreriaEar-1.0-SNAPSHOT.ear"."decore-1.0-SNAPSHOT.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."libreriaEar-1.0-SNAPSHOT.ear"."decore-1.0-SNAPSHOT.jar".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of subdeployment "decore-1.0-SNAPSHOT.jar" of deployment "libreriaEar-1.0-SNAPSHOT.ear"
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_31]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_31]
Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class com.ac.ejbs.SingBean with ClassLoader ModuleClassLoader for Module "deployment.libreriaEar-1.0-SNAPSHOT.ear.decore-1.0-SNAPSHOT.jar:main" from Service Module Loader
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:72) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:107)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:92)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
... 5 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/service/ServiceRegistry
at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.8.0_31]
at java.lang.Class.privateGetDeclaredFields(Class.java:2575) [rt.jar:1.8.0_31]
at java.lang.Class.getDeclaredFields(Class.java:1908) [rt.jar:1.8.0_31]
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:68) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
... 10 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.service.ServiceRegistry from [Module "deployment.libreriaEar-1.0-SNAPSHOT.ear.decore-1.0-SNAPSHOT.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
... 15 more
【问题讨论】:
-
为初学者发布 POM。
-
发布所有代码,包括控制文件,in 问题。否则它们可能无法访问或过时。
标签: java maven jakarta-ee