当前位置: 首页 > 知识库问答 >
问题:

Bean创建异常,注入autowired依赖项失败

马沛
2023-03-14

BeanCreationException:创建名为“Vote Controller”的bean时出错:autowired依赖项的注入失败;嵌套的异常是org.springframework.beans.factory.beanCreationException:不能autowire字段:com.mindtree.service.voteservice com.mindtree.controller.voteController.voteservice;嵌套异常是org.springframework.beans.factory.beanCreationException:创建名为“Vote ServiceImpl”的bean时出错:注入autowired依赖项失败;嵌套异常是org.springframework.beans.factory.beanCreationException:不能autowire字段:com.mindtree.dao.votedao com.mindtree.serviceimpl.voteserviceimpl.votedao;嵌套异常是org.springframework.beans.factory.beanCreationException:创建名为“Vote DAOImpl”的bean时出错:注入autowired依赖项失败;嵌套异常是org.springframework.beans.factory.beanCreationException:不能autowire字段:org.springframework.orm.hibernate3.hibernateTemplate com.mindtree.daoimpl.votedaoimpl.hibernateTemplate;嵌套异常是org.springframework.beans.factory.beanCreationException:创建ServletContext资源[/WEB-INF/applicationContext.xml]中定义的名为“hibernate template”的bean时出错:在设置构造函数参数时无法解析对bean“session Factory”的引用;嵌套异常是org.springframework.beans.factory.beanCreationException:创建ServletContext资源[/WEB-INF/applicationContext.xml]中定义的名称为“session Factory”的bean时出错:bean初始化失败;嵌套异常是java.lang.noClassDefFoundError:org/apache/commons/pool/impl/genericobjectpool

共有1个答案

董嘉祯
2023-03-14

如您在StackTrace中所见:

 nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool

GenericObjectPool在类路径中丢失。

因此,必须将commons-pool.jar添加到包含此类的项目中。

 类似资料: