springboot+mybatis Caused by: org.apache.ibatis.builder.BuilderException:

本文详细解析了MyBatis中Mapper XML配置文件出现命名空间错误的原因及解决方案,通常由于实体类和DAO路径指定错误导致,通过检查并修正路径可以有效解决问题。

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

Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'xxx/xxx/xxxMapper.xml'. Cause: org.apache.ibatis.builder.BuilderException: Wrong namespace. Expected 'xxx.ccc.xxxMapper' but found 'xxx.ccc.xxxMapper'.
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120) ~[mybatis-3.4.6.jar:3.4.6]
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92) ~[mybatis-3.4.6.jar:3.4.6]
	at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:173) ~[mybatis-3.4.6.jar:3.4.6]
	at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:124) ~[mybatis-3.4.6.jar:3.4.6]
	at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:72) ~[mybatis-3.4.6.jar:3.4.6]
	at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:741) ~[mybatis-3.4.6.jar:3.4.6]
	at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:80) ~[mybatis-spring-1.3.2.jar:1.3.2]
	... 50 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Wrong namespace. Expected 'xxx.ccc.xxxMapper' but found 'xxx.xxx.xxxMapper'.
	at org.apache.ibatis.builder.MapperBuilderAssistant.setCurrentNamespace(MapperBuilderAssistant.java:78) ~[mybatis-3.4.6.jar:3.4.6]
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:112) ~[mybatis-3.4.6.jar:3.4.6]
	... 56 common frames omitted

mybatis的mapper.xml配置文件中指定的实体类和Dao找不到!!!

一般情况下是没有创建或者是指定的路径有误(我当时是从其他项目中拷贝过来的 所以指定的包的路径有问题)

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值