Hibernate:initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

时间:2014-10-10 21:54:44   收藏:0   阅读:192

Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userAction‘: Injection of resource fields failed; nested exception         is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userService‘: Injection of resource fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userDao‘: Injection of resource fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘hibernateTemplate‘ defined in class path resource [spring/applicationContext-db.xml]: Cannot resolve reference to bean ‘sessionFactory‘ while setting bean property ‘sessionFactory‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [spring/applicationContext-db.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/persistence/Entity

 

 

由NoClassDefFoundError可以知道,明显是缺少包,再百度一下javax/persistence/Entity,答案出来了,少了hibernate-jpa-2.0-api-1.0.0.Final.jar,导入之后就行了

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!