创建名为'transactionManager'的bean时出错

时间:2013-05-02 09:56:28

标签: spring hibernate maven transactionmanager

我收到了这个错误:

ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in file [C:\Users\Tecnico1\Documents\workspace-sts-3.2.0.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\marshall\WEB-INF\classes\META-INF\spring\applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file [C:\Users\Tecnico1\Documents\workspace-sts-3.2.0.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\marshall\WEB-INF\classes\META-INF\spring\applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: @OneToOne or @ManyToOne on 
………
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file [C:\Users\Tecnico1\Documents\workspace-sts-3.2.0.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\marshall\WEB-INF\classes\META-INF\spring\applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: @OneToOne or @ManyToOne on
….….
Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.springsource.marshall.domain.DocumentoReservaHabitacion.reservaHabitacionId references an unknown entity: com.springsource.marshall.domain.ReservaHabitacion
…………

我是初学者,我没有发现错误......也许我有重复的罐子......在那种情况下......我要删除哪个罐子?

谢谢!

1 个答案:

答案 0 :(得分:0)

您的实体com.springsource.marshall.domain.ReservaHabitacion未映射到hibernate.cfg.xml文件中,或者您在该类上缺少@Entity注释。