关于Springboot调错篇——Error creating bean with name 'sqlSessionFactoryBean--Mapper映射问题

控制台不停在告警,随便粘贴几条看看:

2017-06-06 17:46:10.242  WARN 6524 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'monthReportMapper' defined in file [F:\springboot-mybatis-master\springboot-mybatis-master\target\classes\com\droi\monthReport\mapper\MonthReportMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sqlSessionFactoryBean' defined in com.droi.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactoryBean' threw exception; nested exception is java.lang.NoClassDefFoundError: com/droi/droiActive/model/droiActiveVO (wrong name: com/droi/droiActive/model/DroiActiveVO); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactoryBean' defined in com.droi.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactoryBean' threw exception; nested exception is java.lang.NoClassDefFoundError: com/droi/droiActive/model/droiActiveVO (wrong name: com/droi/droiActive/model/DroiActiveVO)

2017-06-06 17:46:10.254  WARN 6524 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'droiActiveMapper' defined in file [F:\springboot-mybatis-master\springboot-mybatis-master\target\classes\com\droi\droiActive\mapper\DroiActiveMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sqlSessionFactoryBean' defined in com.droi.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactoryBean' threw exception; nested exception is java.lang.NoClassDefFoundError: com/droi/droiActive/model/droiActiveVO (wrong name: com/droi/droiActive/model/DroiActiveVO); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactoryBean' defined in com.droi.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactoryBean' threw exception; nested exception is java.lang.NoClassDefFoundError: com/droi/droiActive/model/droiActiveVO (wrong name: com/droi/droiActive/model/DroiActiveVO)

2017-06-06 17:46:10.266  WARN 6524 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Bean creation exception on FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'droiActiveMapper' defined in file [F:\springboot-mybatis-master\springboot-mybatis-master\target\classes\com\droi\droiActive\mapper\DroiActiveMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sqlSessionFactoryBean' defined in com.droi.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactoryBean' threw exception; nested exception is java.lang.NoClassDefFoundError: com/droi/droiActive/model/droiActiveVO (wrong name: com/droi/droiActive/model/DroiActiveVO); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactoryBean' defined in com.droi.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactoryBean' threw exception; nested exception is java.lang.NoClassDefFoundError: com/droi/droiActive/model/droiActiveVO (wrong name: com/droi/droiActive/model/DroiActiveVO)

 

sqlSessionFactory': : Error creating bean with name 'sqlSessionFactoryBean' defined in com.droi.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactoryBean' threw exception; nested exception is java.lang.NoClassDefFoundError: com/droi/droiActive/model/droiActiveVO (wrong name: com/droi/droiActive/model/DroiActiveVO); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactoryBean' defined in com.droi.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactoryBean' threw exception; nested exception is java.lang.NoClassDefFoundError: com/droi/droiActive/model/droiActiveVO (wrong name: com/droi/droiActive/model/DroiActiveVO) 

 

原来原因是:无法实例化

由于找不到定义的实体类,那么我们跟着这个报错去看看一看mapper接口:

 

 

 

保证这里红色部分包位置一致,映射位置一致

 

 

 

 

 

 

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
根据提供的引用内容,错误信息 "Error creating bean with name 'userMapper'" 可能是由于Mapper.xml文件的映射地址写错了导致的。请检查Mapper.xml文件中的映射地址是否正确,并确保正确引用了正确的实体类。 此外,根据引用中提到的"Guns-VIP"框架,可能需要对代码生成工具进行配置和使用。如果使用了该框架,确保已正确配置代码生成工具和相关依赖。 另外,根据引用中提到的编写代码时可能遇到的问题,即使是经验丰富的程序员也可能遇到报错的情况。在遇到报错时,可以尝试平静下来,耐心地分析和梳理问题。如果情绪不好,可以暂时放下代码,出去放松一下,等心情好了再回来解决问题。 综上所述,针对 "Error creating bean with name 'userMapper'" 的问题,需要检查Mapper.xml文件的映射地址是否正确,并确保使用了正确的实体类。同时,可以考虑配置和使用代码生成工具来简化开发过程。如果遇到报错,可以保持冷静并耐心地解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource [org/mybatis/...](https://blog.csdn.net/Universe_A/article/details/125985693)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [guns-vip-master --含代码生成--V3.4.zip](https://download.csdn.net/download/weixin_46008168/12609146)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值