2012-06-18 53 views
4

我們有一個Java EE 6的應用目前在JBoss中6上運行的應用程序使用一個定製的Hibernate持久性提供在「persistence.xml中」自定義的Hibernate持久性提供與JBoss 7.1.1

定製的持久性提供一流的繼承來自org.hibernate.ejb.HibernatePersistence。

定製的持久性提供程序打包在應用程序的'ear'文件中。

現在將應用程序部署到JBoss時出現7.1.1以下異常:

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 

什麼是我們錯在這裏做什麼?

回答

1

這可能就像將org.hibernate添加到您的MANIFEST.MF一樣簡單。也可能是您的自定義提供程序不在正確的目錄中,EAR/lib是默認情況下的預期位置。

先看看class loading documentation。具體在你的情況下,EAR class loading

相關問題