Error creating bean with name 'sessionFactory' defined in classpath resource [beans.xml]

本文分享了在搭建OA系统的SSH框架过程中遇到的一个错误及其解决办法。错误为创建名为'sessionFactory'的bean时出现异常,提示无法解析Role.hbm.xml映射文件。通过检查配置文件、确认jar包导入、验证Tomcat配置及JRE环境等步骤解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

(以下内容为自己在学习和开发中所遇到的问题及解决办法,如有不当之处,欢迎指正)

在搭建OA的ssh框架时报如下错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in classpath resource [beans.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from file D:\Tomcat\apache-tomcat-7.0.70-windows-x86\apache-tomcat-7.0.70\wtpwebapps\OA\WEB-INF\classes\cn\gao\oa\domain\Role.hbm.xml

解决办法:

1.检查beans.xml配置文件、Role.hbm.xml配置文件是否正确;

2.检查ssh所需要用到的jar包是否都导入lib包下;

3.检查tomcat配置是否正确;

4.检查jre环境是否正确。

5.更换eclipse工作空间。

22:02:39.715 [restartedMain] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - [refresh,599] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'captchaController': Unsatisfied dependency expressed through field 'configService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysConfigServiceImpl': Unsatisfied dependency expressed through field 'configMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysConfigMapper' defined in file [C:\Users\20991\Desktop\RuoYi-Vue-master\ruoyi-system\target\classes\com\ruoyi\system\mapper\SysConfigMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/ruoyi/framework/config/MyBatisConfig.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dynamicDataSource' defined in class path resource [com/ruoyi/framework/config/DruidConfig.class]: Unsatisfied dependency expressed through method 'dataSource' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'masterDataSource' defined in class path resource [com/ruoyi/framework/config/DruidConfig.class]: Unsatisfied dependency expressed through method 'masterDataSource' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'druidProperties': Injection of autowired dependencies failed; nested exception is java
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值