2013-02-26 23:09:02.285::WARN: Failed startup of
context
org.mortbay.jetty.webapp.WebAppContext@1f9b804{/smartmeeting,D:\workspace\smartmeeting\src\main\webapp}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentContr': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wushi.smartmeeting.service.DocumentServiceImpl com.wushi.smartmeeting.controller.DocumentContr.documentService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'docService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wushi.smartmeeting.dao.DocumentDAO com.wushi.smartmeeting.service.DocumentServiceImpl.docDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.wushi.smartmeeting.dao.DocumentDAO.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.wushi.smartmeeting.model.MeetingDocument.meeting references an unknown entity: com.wushi.smartmeeting.model.Meeting
at
org.springframe
==================
解决办法:
在Meeting class 中增加 @Entity
@Table("MEETING")
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentContr': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wushi.smartmeeting.service.DocumentServiceImpl com.wushi.smartmeeting.controller.DocumentContr.documentService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'docService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wushi.smartmeeting.dao.DocumentDAO com.wushi.smartmeeting.service.DocumentServiceImpl.docDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.wushi.smartmeeting.dao.DocumentDAO.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.wushi.smartmeeting.model.MeetingDocument.meeting references an unknown entity: com.wushi.smartmeeting.model.Meeting
==================
解决办法:
在Meeting class 中增加 @Entity
本文记录了一次Spring框架中出现的依赖注入失败问题及其解决过程。问题出现在文档控制系统中,涉及DocumentServiceImpl、DocumentContr及DocumentDAO等组件之间的依赖关系。最终发现是由于MeetingDocument实体类中的关联映射配置错误导致Hibernate无法识别关联的Meeting实体类。
499

被折叠的 条评论
为什么被折叠?



