mybatis一个怪异的问题: Invalid bound statement not found

ssm中报一下错误:

invalid bound statement (not found): me.tspace.pm.dao.userdao.getuser
    at org.apache.ibatis.binding.mappermethod$sqlcommand.<init>(mappermethod.Java:178)
    at org.apache.ibatis.binding.mappermethod.<init>(mappermethod.java:38)
    at org.apache.ibatis.binding.mapperproxy.cachedmappermethod(mapperproxy.java:49)
    at org.apache.ibatis.binding.mapperproxy.invoke(mapperproxy.java:42)
    at $proxy22.getuser(unknown source)

........................

........................

caused by: java.lang.illegalargumentexception: mapped statements collection does not contain value for me.tspace.pm.dao.userdao.getuser

at org.apache.ibatis.session.configuration$strictmap.get(configuration.java:775)
    at org.apache.ibatis.session.configuration.getmappedstatement(configuration.java:615)
    at org.apache.ibatis.session.configuration.getmappedstatement(configuration.java:608)
    at org.apache.ibatis.binding.mappermethod$sqlcommand.<init>(mappermethod.java:176)

... 34 more

三种情况:

1.

<mapper namespace="me.tspace.pm.dao.userdao">

mapper的namespace写的不对!!!注意系修改。

2.

userdao的方法在userdao.xml中没有,然后执行userdao的方法会报此

3. userdao的方法返回值是list<user>,而select元素没有正确配置resultmap,或者只配置resulttype!

4. 如果你确认没有以上问题,请任意修改下对应的xml文件,比如删除一个空行,保存.问题解决...

转载自http://blog.csdn.net/two_people/article/details/51984516

时间: 2024-08-03 12:17:38

mybatis一个怪异的问题: Invalid bound statement not found的相关文章

在使用mybatis的selectFromExample时出现Invalid bound statement (not found)错误

主要原因:运行项目在构建的时候只会默认的去加载resource资源文件里面的资源,其他地方的配置资源不会加载 .故没有读取到mybatis的MapperXml映射 结构如下 ============================================================= tomcat控制台报错如下: 三月 22, 2018 8:31:52 下午 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet

myBatis的binding错误:Invalid bound statement (not found)

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误这个问题我找了好久,终于找到了正确的写法: <select id="getEmpByIdAndLastName" resultType="com.atguigu.mybatis.bean.Employee"> select id, last_name, gender, email from tb

MyBatis使用动态代理报 invalid bound statement (not found) 错

这个问题网上大部分都说xml文件中的路径不对 或者是resources之类的问题,如果那些文章的解决方案解决不了你的问题的话,可以看一下我遇到的这种情况: Mapper Interface和 Mapper xml 的路径一致  但是Mapper xml所在的文件夹应为一个package而不是普通的文件夹,如果你创建的时候是创建的普通文件夹,把这个文件夹改为package即可解决. 原文地址:https://www.cnblogs.com/Alex-zqzy/p/9286371.html

springboot+mybatis报错Invalid bound statement (not found)

今天做项目时报了一个错提示说Invalid bound statement (not found),也就是说mapper接口绑定.xml文件出错了,找不到指定的sql:原因是程序没有把.xml文件编译到classes路径下,这时需要在pom.xml文件的<build>标签中加入下面的配置解决<resources> <!-- maven项目中src源代码下的xml等资源文件编译进classes文件夹, 注意:如果没有这个,它会自动搜索resources下是否有mapper.xm

mybatis中Invalid bound statement (not found) 和 Result Maps collection already contains value for...错误解决方案

一.Invalid bound statement (not found) 使用mybatis有时候会报Invalid bound statement (not found)这种错误,总结了下,可能有两种情况如下: 1.mybatis的对应的mapper.xml找不到对应的命名sql或者名称与mapper接口名称不一致. 2.xml文件与接口名称都对,但是在mybatis配置文件中漏掉了配置,也会报这种错误. 二.Result Maps collection already contains v

关于mybatis Invalid bound statement (not found) 问题

初学mybatis   现在系统是spring + mybatis  applicationContext.xml里面配置了Mapper 自动扫描 <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">    <property name="basePackage" value="com.yolly.platform.*" /></bean&g

MyBatis笔记----报错Exception in thread &quot;main&quot; org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.ij34.model.UserMapper.selectUser

信息: Refreshing org[email protected]41cf53f9: startup date [Wed Apr 05 16:48:12 CST 2017]; root of context hierarchy 四月 05, 2017 4:48:12 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息: Loading XML bean definiti

mybatis错误之org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

玩了MyBatis差不多有两年了,中间也玩过MyBatis-Plus,这个MyBatis-Plus其实与MyBatis的区别并不大.今天写博客业务代码的时候,犯一个初学者犯过的错误. 错误信息如下:org.apache.ibatis.binding.BindingException: Invalid bound statement(not found) 通常原因是因为Mapper interface和xml文件的定义对不上,通常需要检查包名.namespace.函数名等. 出现这个错误的原因是我

Invalid bound statement (not found)--spring boot集成mybatis

问题: {"timestamp":"2019-07-02T10:21:32.379+0000","status":500,"error":"Internal Server Error","message":"Invalid bound statement (not found): com.example.mybatistest.mapper.ISelectIdMapper.se