Maven+mybatis报错Invalid bound statement (not found)问题处理(以及读不到resources下配置文件的问题)

在使用Maven构建SSM项目时,遇到Mybatis访问数据库时报'Invalid bound statement (not found)'错误。尝试在pom.xml中添加resource节点解决后,发现资源文件无法读取,且位置异常。解决方案是在pom.xml中增加特定配置,确保maven同时处理src/main/java和src/main/resources下的文件,避免mapper XML文件遗漏和资源配置问题。
摘要由CSDN通过智能技术生成

最近在用Maven架SSM测试项目的时候遇到一个坑,一切配置正确的情况下通过mybatis访问数据库的时候报错如下:

严重: Servlet.service() for servlet [web] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.guli.mapper.UserMapper.getUserById] with root cause
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.guli.mapper.UserMapper.getUserById
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:189)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:43)
	at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:58)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:51)
	at com.sun.proxy.$Proxy31.getUserById(Unknown Source)
	at com.guli.service.impl.UserServiceImpl.getUserById(UserServiceImpl.java:17)
	at sun.reflect.NativeMethodAccessorImpl.invoke
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值