mybatis遇到的Invalid bound statement (not found)

mybatis一个怪异的问题:
Invalid bound statement (not found): cn.com.dao.UserDao.selectByUser at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:178)    at org.apache.ibatis.binding.MapperMethod.(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.selectByUser(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for cn.com.dao.UserDao.selectByUser
    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.(MapperMethod.java:176)
    ... 34 more

1. 我检查了半天也没看出什么问题来,后来把mapper的xml select 语句重写。问题竟然好了。出了这种问题:

 

mapper的namespace写的不对!


parameterType没有写对。

2. UserDao的方法在UserDao.xml中没有,然后执行UserDao的方法会报此错
3. 删除配置文件里中文的注释,保存.
4. Mybatis的自动扫描 错误
  
          
          
          
  

value="classpath:com/test/mapping/*.xml"没有写对

  
      
          
          
  

没有写对

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

你可能感兴趣的:(mybatis遇到的Invalid bound statement (not found))