org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bidBiz' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
<bean name="bidDAO" class="com.zxpm.dao.impl.BidDAOImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean name="bidBiz" class="com.zxpm.biz.impl.BidBizImpl">
<property name="bidDAO" ref="bidDAO"/>
</bean>
<bean name="bid" class="com.zxpm.action.BidAction">
<property name="bidBiz" ref="bidBiz"/>
<property name="goodsBiz" ref="goodsBiz"/>
<property name="userBiz" ref="userBiz"/>
</bean>
出现这种情况的原因是MyBatis与Spring MVC结合时导致了混乱。可以按一下方法来解决:
(1)maven install 一下,看看是否有缺少相关的jar引起的。
(2)换一个环境进行尝试。
(3)确认所有的环境配好没有,准备的是否充分比如jdk,maven ,jar,配置文件。
(4)可以使用@Qualifier注解和@Autowired注解通过指定哪一个真正的Bean将会被装配来消除混乱。
①在DAO中加入如下代码:
@Autowired(required = false)
@Qualifier("sqlSessionFactory")
public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) { super.setSqlSessionFactory(sqlSessionFactory);
}
①②还可以这样写:
@Autowired(required = false) public void setSqlSessionFactory(
@Qualifier("sqlSessionFactory")
SqlSessionFactory sqlSessionFactory) { super.setSqlSessionFactory(sqlSessionFactory);
}
sessionFactory已经配了啊。
但是还是上面的错误,????????
放定义的构造中
Invocation of init method failed,这个错误怎么解决?
(1)maven install 一下,看看是否有缺少相关的jar引起的。(2)换一个环境进行尝试。(3)确认所有的环境配好没有,准备的是否充分比如jdk,maven ,jar,配置文件。(4)可以使用@Qualifier注解和@Autowired注解通过指定哪一个真正的Bean将会被装配来消除混乱。①在DAO中加入如下代码:Autowired(require...
Invocation of init method failed; 无法解析hibernate配置文件...
abstract="true"去掉试试
(难)Spring整合hibernate时,出现下边的错误,哪位高手能帮我看出个一二...
<\/beans> 多的删掉 照着改点 希望能帮到你 我就是拿这个当ssh配置文件时spring配置文件的模板
Error parsing Mapper XML. Cause: java.lang.NullPointerException_百 ...
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [G:\\tomcat\\apache-tomcat-7.0.57\\webapps\\springmvc_mybatis\\WEB-INF\\classes\\com\\tanghaibin\\mapper\\UserMapper.class]: Invocation of init method failed; nest...
程序报错,不能正常初始化
1.是不是配置文件的设置有问题或者放置的路径不对,因为我看你应该使用的是默认路径。2.创建hibernate的sessionFactory没有成功,大都是你的hibernate.cfg.xml有问题 3.没有初始化你的映射文件,把工程清了,再重新发布一遍。
项目部署weblogic后启动weblogic服务器报错,求大神指点
Error creating bean with name 'entityManagerFactory' defined in URL [zip:D:\/bea\/user_projects\/domains\/base_domain\/servers\/AdminServer\/tmp\/_WL_user\/cjcar_ev\/je8vm4\/war\/WEB-INF\/lib\/_wl_cls_gen.jar!\/spring\/applicationContext.xml]: Invocation of init method failed; nested exception is java....
...initialized event to listener instance of class
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'LoginServiceGhr' defined in ServletContext resource [\/WEB-INF\/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' ...
SpringBoot+Mybatis-Plus整合Sharding-JDBC5.1.1实现分库分表【全网最新...
5. 启动类Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [D:\\jiawayun\\demo\\target\\classes\\com\\example\\demo\\mapper\\UserMapper.class]: Invocation of init method failed; nested exception isjava.lang.IllegalArgumentException...
Caused by: java.lang.NoSuchMethodError:
Error creating bean with name 'transactionManager' defined in file [C:\\Users\\dengt\\Desktop\\workspaceAloys\\.metadata\\.plugins\\org.eclipse.wst.server.core\\tmp2\\wtpwebapps\\Hibernate\\WEB-INF\\classes\\config\\springAnnotation-hibernate.xml]: Invocation of init method failed; ...
启动tomcat后报错 org.springframework.beans.factory.BeanCreation...
Error creating bean with name 'configLoader' defined in URL [jar:file:\/C:\/Program%20Files\/Apache%20Software%20Foundation\/Tomcat%206.0\/webapps\/ChargeManagement\/WEB-INF\/lib\/zksoft-ui-core-3.0.jar!\/spring\/applicationContext-ui-loader.xml]: Invocation of init method failed; nested ...