AS 7 Custom Hibernate Persistence Provider in EAR
woelfle Jun 18, 2012 9:02 AMWe have have a custom implementation of HibernatePersistence. We've packaged it in the 'ear' file since it uses other classes from our application. When deploying the application a 'NoClassDefFoundError' for 'org.hibernate.ejb.HibernatePersistence' occurs.
08:50:14,766 WARN [org.jboss.modules] (MSC service thread 1-2) Failed to define class my.custom.HibernatePersistence in Module "deployment.ear.ear:main" from Service Module Loader: java.lang.LinkageError: Failed to link my/custom/HibernatePersistence (Module "deployment.ear.ear:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
at org.jboss.as.jpa.processor.PersistenceProviderProcessor.deploy(PersistenceProviderProcessor.java:76)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
Caused by: java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0]
at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391) [jboss-modules.jar:1.1.1.GA]
... 15 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence from [Module "deployment.ear.ear:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
... 20 more
08:50:14,789 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."ear.ear".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."ear.ear".INSTALL: Failed to process phase INSTALL of deployment "ear.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011426: Could not deploy application packaged persistence provider 'my.custom.HibernatePersistence'
at org.jboss.as.jpa.processor.PersistenceProviderProcessor.deploy(PersistenceProviderProcessor.java:91)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: java.lang.ClassNotFoundException: my.custom.HibernatePersistence from [Module "deployment.ear.ear:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at org.jboss.as.jpa.processor.PersistenceProviderProcessor.deploy(PersistenceProviderProcessor.java:76)
... 6 more
'jar tf' on our ear file lists following contents:
META-INF/
META-INF/MANIFEST.MF
lib/
services-0.0.22-SNAPSHOT.jar
META-INF/application.xml
lib/guava-r07.jar
lib/asm-analysis-3.2.jar
lib/persistence_api-0.0.22-SNAPSHOT.jar
lib/asm-3.2.jar
lib/services_api-0.0.22-SNAPSHOT.jar
lib/asm-tree-3.2.jar
lib/utils-0.0.22-SNAPSHOT.jar
lib/asm-util-3.2.jar
lib/joda-time-2.0.jar
lib/domain-0.0.22-SNAPSHOT.jar
lib/antlr-2.7.7.jar
lib/commons-codec-1.3.jar
lib/asm-commons-3.2.jar
lib/backport-util-concurrent-3.1.jar
lib/commons-lang-2.4.jar
lib/commons-io-1.4.jar
lib/commons-logging-1.1.1.jar
lib/persistence_impl-0.0.22-SNAPSHOT.jar
META-INF/maven/
META-INF/maven/de.patronas.opus.server/
META-INF/maven/de.patronas.opus.server/ear/
META-INF/maven/de.patronas.opus.server/ear/pom.xml
META-INF/maven/de.patronas.opus.server/ear/pom.properties
Any idea what we've done wrong?
Thanks