java.lang.NoClassDefFoundError:无法初始化类org.hibernate.ejb.Ejb3Configuration

时间:2012-08-31 12:36:19

标签: java hibernate jpa ejb

我是EJB新手。我的经理告诉我在我们的测试服务器中部署一个ejb应用程序进行一些修改。该应用程序已在我们的生产服务器中运行。但是当我部署应用程序时,我得到了一个例外。

我们正在使用Glassfish Application Server

异常的堆栈跟踪:

java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.ejb.Ejb3Configuration
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:130)
        at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:149)
        at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:84)
        at com.sun.enterprise.server.AbstractLoader.loadPersistenceUnits(AbstractLoader.java:915)
        at com.sun.enterprise.server.ApplicationLoader.doLoad(ApplicationLoader.java:184)
        at com.sun.enterprise.server.TomcatApplicationLoader.doLoad(TomcatApplicationLoader.java:126)
        at com.sun.enterprise.server.ExtendedApplicationLoader.doLoad(ExtendedApplicationLoader.java:134)
        at com.sun.enterprise.server.AbstractLoader.load(AbstractLoader.java:240)  
        at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:336)  
        at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:210)  
        at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:645)  
        at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeApplicationDeployEventListener(AdminEventMulticaster.java:959)  
        at com.sun.enterprise.admin.event.AdminEventMulticaster.handleApplicationDeployEvent(AdminEventMulticaster.java:943)
        at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:467)  
    at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:182)
    at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:308)
    at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:231)
    at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:298)
    at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:132)
    at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:609)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:653)
    at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:773)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:390)
    at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:373)
    at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:477)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:857)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:795)
    at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:90)
    at $Proxy1.invoke(Unknown Source)  
    at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:304)
    at com.sun.enterprise.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:170)
    at com.sun.enterprise.deployment.client.DeploymentClientUtils.startApplication(DeploymentClientUtils.java:159)
    at com.sun.enterprise.deployment.client.DeployAction.run(DeployAction.java:538)
    at java.lang.Thread.run(Thread.java:636)    

当我重新启动服务器时,我得到了这些:

Unexpected error occurred while loading applications  
java.lang.IncompatibleClassChangeError: Implementing class  
at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:632)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
    at com.sun.appserv.server.util.ASURLClassLoader.loadClass(ASURLClassLoader.java:144)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
    at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:107)
    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:130)
    at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:149)
    at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:84)
    at com.sun.enterprise.server.AbstractLoader.loadPersistenceUnits(AbstractLoader.java:915)
    at com.sun.enterprise.server.ApplicationLoader.doLoad(ApplicationLoader.java:184)
    at com.sun.enterprise.server.TomcatApplicationLoader.doLoad(TomcatApplicationLoader.java:126)
    at com.sun.enterprise.server.ExtendedApplicationLoader.doLoad(ExtendedApplicationLoader.java:134)
    at com.sun.enterprise.server.AbstractLoader.load(AbstractLoader.java:240)
    at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:226)
    at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:224)
    at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:449)
    at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:134)
    at com.sun.enterprise.server.PEMain.run(PEMain.java:409)
    at com.sun.enterprise.server.PEMain.main(PEMain.java:336)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at com.sun.enterprise.server.PELaunch.main(PELaunch.java:415)  

在这里,您也可以看到同样的问题at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:107)

任何人可以帮助我解决此错误的原因 非常需要它。

由于

1 个答案:

答案 0 :(得分:6)

解决问题。
实际上hibernate-annotations.jar文件在服务器的lib文件夹中的版本不同 有人可能已经改变了它。现在它正常工作。

谢谢。