java.lang.ClassNotFoundException: org.hibernate.annotations.Entity

问题描述

最近要把hibernate从3.2升级到3.67。更换JAR包之后,报以下错误,但那个entity在hibernate3.jar包里面是有。先谢谢大家!gframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)atweblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:465)atweblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)atweblogic.security.service.SecurityManager.runAs(UnknownSource)atweblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:175)atweblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1784)atweblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2999)atweblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1371)atweblogic.servlet.internal.WebAppModule.start(WebAppModule.java:468)atweblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)atweblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)atweblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)atweblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)atweblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)atweblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)atweblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)atweblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)atweblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)atweblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)atweblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)atweblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)atweblogic.application.internal.EarDeployment.activate(EarDeployment.java:16)atweblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:162)atweblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)atweblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)atweblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)atweblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)atweblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:196)atweblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)atweblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)atweblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)atweblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)atweblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)atweblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)atweblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)atweblogic.work.ExecuteThread.execute(ExecuteThread.java:201)atweblogic.work.ExecuteThread.run(ExecuteThread.java:173)java.lang.NoClassDefFoundError:org/hibernate/annotations/Entityatorg.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.<init>(AnnotationSessionFactoryBean.java:93)atsun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeMethod)atsun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)atsun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)atjava.lang.reflect.Constructor.newInstance(Constructor.java:513)atorg.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)atorg.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)atorg.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)atweblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:465)atweblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)atweblogic.security.service.SecurityManager.runAs(UnknownSource)atweblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:175)atweblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1784)atweblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2999)atweblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1371)atweblogic.servlet.internal.WebAppModule.start(WebAppModule.java:468)atweblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)atweblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)atweblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)atweblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)atweblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)atweblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)atweblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)atweblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)atweblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)atweblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)atweblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)atweblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)atweblogic.application.internal.EarDeployment.activate(EarDeployment.java:16)atweblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:162)atweblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)atweblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)atweblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)atweblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)atweblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:196)atweblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)atweblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)atweblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)atweblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)atweblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)atweblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)atweblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)atweblogic.work.ExecuteThread.execute(ExecuteThread.java:201)atweblogic.work.ExecuteThread.run(ExecuteThread.java:173)>

解决方案

解决方案二:
java.lang.ClassNotFoundException:org.hibernate.annotations.Entityatweblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)atweblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)atjava.lang.ClassLoader.loadClass(ClassLoader.java:306)atjava.lang.ClassLoader.loadClass(ClassLoader.java:251)atweblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:176)atjava.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)atorg.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.<init>(AnnotationSessionFactoryBean.java:93)atsun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeMethod)atsun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)atsun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)atjava.lang.reflect.Constructor.newInstance(Constructor.java:513)atorg.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)atorg.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)atorg.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)atweblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:465)atweblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)atweblogic.security.service.SecurityManager.runAs(UnknownSource)atweblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:175)atweblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1784)atweblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2999)atweblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1371)atweblogic.servlet.internal.WebAppModule.start(WebAppModule.java:468)atweblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)atweblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)atweblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)atweblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)atweblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)atweblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)atweblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)atweblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)atweblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)atweblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)atweblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)atweblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)atweblogic.application.internal.EarDeployment.activate(EarDeployment.java:16)atweblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:162)atweblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)atweblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)atweblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)atweblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)atweblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:196)atweblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)atweblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)atweblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)atweblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)atweblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)atweblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)atweblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)atweblogic.work.ExecuteThread.execute(ExecuteThread.java:201)atweblogic.work.ExecuteThread.run(ExecuteThread.java:173)
解决方案三:
看看有没有重复的包或者少包
解决方案四:
引用2楼aqqbjlgu的回复:

看看有没有重复的包或者少包

org.hibernate.annotations.Entity这个类在hibernate3.jar包里是有的。
解决方案五:
有没有重复的包?
解决方案六:
弄了好几天。把hibernate-jpa-2.0-api-1.0.1.Final.jar包重命名为javax.persistence_1.0.0.0_1-0.jar然后覆盖到D:bea103modules(weblogic安装目录)目录下就正常了,不知道是什么原因呢?
解决方案七:
引用5楼brave112的回复:

弄了好几天。把hibernate-jpa-2.0-api-1.0.1.Final.jar包重命名为javax.persistence_1.0.0.0_1-0.jar然后覆盖到D:bea103modules(weblogic安装目录)目录下就正常了,不知道是什么原因呢?

什么情况??
解决方案八:

解决方案九:
引用5楼brave112的回复:

弄了好几天。把hibernate-jpa-2.0-api-1.0.1.Final.jar包重命名为javax.persistence_1.0.0.0_1-0.jar然后覆盖到D:bea103modules(weblogic安装目录)目录下就正常了,不知道是什么原因呢?

是不是hibernate-jpa-2.0-api-1.0.1.Final.jar和javax.persistence_1.0.0.0_1-0.jar有相同的Entity类导致调用混淆了
解决方案十:
你hibernate2的jar都完全删除了吗?在工程里面搜一下,看org.hibernate.annotations.Entity这个class文件有几个?如果有多个,系统就不知道找哪一个,报找不到错误了。
解决方案十一:
什么情况?我也遇到了这个问题,求合理的解决方法

时间: 2024-11-03 23:37:32

java.lang.ClassNotFoundException: org.hibernate.annotations.Entity的相关文章

hibernate-Hibernate异常 java.lang.ClassNotFoundException

问题描述 Hibernate异常 java.lang.ClassNotFoundException 19-Oct-2015 23:24:58.329 SEVERE [http-apr-8080-exec-6] org.apache.catalina.core.StandardWrapperValve.invoke Allocate exception for servlet mvc-dispatcher java.lang.ClassNotFoundException: org.hibernat

maven spring3 hibernate4 Caused by: java.lang.ClassNotFoundException: org.hibe

问题描述 org.hibernate.engine.SessionFactoryImplementor三月13,201511:43:07上午org.apache.catalina.core.StandardContextlistenerStart严重:Exceptionsendingcontextinitializedeventtolistenerinstanceofclassorg.springframework.web.context.ContextLoaderListenerorg.spr

eclipse 使用Hibernate出错 java.lang.ClassNotFoundException

问题描述 eclipse使用Hibernate出错java.lang.ClassNotFoundException调试了一天了,各位帮帮忙啊出错信息如下:java.lang.NoClassDefFoundError:org/dom4j/DocumentExceptionorg.util.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:57)org.util.HibernateSessionFac

急!java.lang.NoClassDefFoundError: org/hibernate/HibernateException

问题描述 org.apache.jasper.JasperException:AnexceptionoccurredprocessingJSPpage/notice/show.jspatline118:+path+"/";9:StringUserName=request.getParameter("UserName");10:List<?>list;11:NoticeServicenotice=newNoticeServiceImpl();12:if(U

【报错】spring整合activeMQ,pom.xml文件缺架包,启动报错:Caused by: java.lang.ClassNotFoundException: org.apache.xbean.spring.context.v2.XBeanNamespaceHandler

spring版本:4.3.13 ActiveMq版本:5.15 ======================================================== spring整合activeMQ,pom.xml文件缺架包,启动报错: [springDemo][INFO] [2017-12-11 14:54:57] org.springframework.web.context.ContextLoader.initWebApplicationContext(304) | Root

java.lang.ClassNotFoundException: org.codehaus.jackson.JsonProcessingException 异常解决方案

问题: 在SpringMVC中使用Jackson实现json输出时配置如下: <!-- 输出对象转JSON支持 --> <bean id="stringConverter" class="org.springframework.http.converter.StringHttpMessageConverter"> <property name="supportedMediaTypes"> <list>

class-javabean报错java.lang.ClassNotFoundException

问题描述 javabean报错java.lang.ClassNotFoundException 如题,只是书上的简单例子,三个类放在一个包中,用IntrospectorDemo去解析Colors类,系统提示java.lang.ClassNotFoundException.不知道哪边有问题. import java.beans.*; public class IntrospectorDemo { public static void main(String[] args) { try{Class<

java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener Maven项目下update maven后Eclipse报错:java.lang.ClassNotFoundException: ContextLoaderL 严重: Error configuring application listener of class org.springframework.web.contex

地方-报出java.lang.ClassNotFoundException

问题描述 报出java.lang.ClassNotFoundException Servlet.service() for servlet [tomcat.com.MyTestServlet] in context with path [/MyTest] threw exception [Servlet execution threw an exception] with root cause java.lang.ClassNotFoundException: net.sf.json.JSONO