mybatis配置时出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
如果出现:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
一般的原因是Mapper interface和xml文件的定义对应不上,需要检查包名,namespace,函数名称等能否对应上,需要比较细致的对比,我经常就是写错了一两个字母搞的很长时间找不到错误
按以下步骤一一执行:
1:检查xml文件所在的package名称是否和interface对应的package名称一一对应
2:检查xml文件的namespace是否和xml文件的package名称一一对应
3:检查函数名称能否对应上
4:去掉xml文件中的中文注释
5:随意在xml文件中加一个空格或者空行然后保存
一般来说到此就可以排除错误了
以上是转载自http://blog.csdn.net/softwarehe/article/details/8889206
很自卑,这个方法困扰了5个小时,在这里我已经翻遍了有关这个问题的搜素引擎,都没解决,直到我看到上面那个转载,我出现这个问题上面的方法都没有解决,不过给了这些解决办法给了我一个思路,就是xml编译的问题,去看了编译的文件
编译前

编译后

果然没有编译进来。
解决方法有两种:
1、把*Mapper.xml文件放到resource文件夹下管理
2、pom配置一下编译xml文件
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
两个方法都可以解决。
mybatis配置时出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)的更多相关文章
- idea 单元测试 mybatis spring-test 异常: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
因为在idea中必须在test下才能进行单元测试,所以进行单元测试时,ssm的项目会因为找不到resourece中的配置文件而报错 这里 org.apache.ibatis.binding.Bindi ...
- IDEA+Maven+Mybatis 巨坑:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.rao.mapper.UserMapper.findAll
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.rao.mapper.User ...
- Mybatis笔记二:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
错误异常:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.test.dao.N ...
- mybatis plus 报错 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 少了个范型
- 使用maven整合mybatis时出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
分析原因是mybatis的映射文件的问题,首先进行分析排查: 1.检查mapper接口和对应的xml文件的包名是否对应 2.检查xml文件的namespace与mapper接口的包名是否对应 3.检查 ...
- MyBatis典型的错误org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
XXXmapper.java(接口) XXXmapper.xml(结果集映射) //此两个文件要在统一包下,且xml中的namespace是唯一的,为了区分须写成 该xml的全路径
- Java学习-052-(mybatis+mysql)访问接口时提示:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
在配置mybatis,访问接口提示: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found),部 ...
- 解决 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 以及MyBatis批量加载xml映射文件的方式
错误 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 的出现,意味着项目需要xml文件来 ...
- mybatis使用时org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):的错误
最近在使用mybatis时,出现了 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 这 ...
随机推荐
- Java学习笔记之——常用转义符号
\ 单独用会报错 \\ 打印右斜杠 \n 换行 \t Tab键 \" 双引号 \' 单引号
- Web前端基础——jQuery(三)
本文主要从以下几方面介绍jQuery应用中的内容: 1 jQuery 节点遍历2 jQuery 中的过滤器3 jQuery 属性操作4 jQuery Dom节点操作5 几个jQuery例子6 jQue ...
- 【原】Spring AOP实现对Redis的缓存同步
前言:刚开始采用spring cache作为缓存数据,到后面发现扩展性不灵活,于是基于sprig cache原理自定义一套规则用于缓存数据. 请求过程: 根据请求参数生成Key,后面我们会对生成Key ...
- 【Mybatis】1、Mybatis拦截器学习资料汇总
MyBatis拦截器原理探究 http://www.cnblogs.com/fangjian0423/p/mybatis-interceptor.html [myBatis]Mybatis中的拦截器 ...
- 【Java基础】13、抽象方法不能是static或native或synchroniz 原因及误解
在网上看到过这么一篇文章,是关于抽象方法不能是static或native或synchroniz 的原因.其中提到了这些关键字的意义以及与 abstract 关键字的冲突,大体内容如下: 1.abstr ...
- Placement of class definition and prototype
When I create a function, I can put the code for it after main if I put the prototype above main. Fo ...
- 每个JavaScript工程师都应懂的33个概念
摘要: 基础很重要啊! 原文:33 concepts every JavaScript developer should know 译文:每个 JavaScript 工程师都应懂的33个概念 作者:s ...
- canvas-0translate.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- HTML的head标签
前端开发工具介绍: Hbuilder:可以快速的生成HTML标准文档结构,集成了很多方便的快捷键.--------------------------------------------------- ...
- PATH、CLASSPATH、CLASSPATH
PATH: 说明: 环境变量中的path,意在在向计算机发出指令时的一个指向路径,如 一般会在path里加上:%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin 其中:%JAVA_ ...