org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误几种解决方案
报错信息:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.study.server.mapper.UserMapper.insert
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:227)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:49)
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
at com.sun.proxy.$Proxy88.insert(Unknown Source)
根本原因:
一是配置文件,二是注解。
网上总结的一般原因:
Mapper interface和xml文件的定义对应不上,需要检查包名,namespace,函数名称等能否对应上。
按以下步骤一一执行:
1、检查xml文件所在的package名称是否和interface对应的package名称一一对应
2、检查xml文件的namespace是否和xml文件的package名称一一对应
3、检查函数名称能否对应上
4、去掉xml文件中的中文注释
5、随意在xml文件中加一个空格或者空行然后保存
项目中的解决方法:
第一种可能:在使用IDEA开发时,如果打包时*Mapper.xml没有自动复制到class输出目录的mapper类包下,则需要在pom文件中添加mybatis加载配置文件的配置!
如下:
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
通过在pom文件中添加mybatis加载配置文件,完美解决遇到的问题了
第二种可能:如果你的项目类似功能无问题,那么问题可能出在了mybatis配置问题,加载mapper.xml时出来问题。
<mapper resource="mybatisMapper/GiftTypeEntityMapper.xml"></mapper>
以上方案则为博主查找到的解决此问的所有方法
上文出自胖胖,转载请附带原文链接
后续更新自学的方法,以及java知识总结
我是哪怕前路坎坷,也不愿负年轻的胖胖,自学之路,共勉
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误几种解决方案的更多相关文章
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 错误解决
报错信息:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 说明:这段报错信息表示 Map ...
- 解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误
我调这个bug调了一天多,在网上搜索的检查namespace,package等,都没有错.错误提示是没有找到xml文件,我就纳闷了,为什么找不到呢?后来才发现,原来是resource中奇怪的目录为题, ...
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): da.huying.usermanag ...
- Exception:HTTP Status 500 - org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
主要错误信息如下: HTTP Status 500 - org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...
- mybatis使用时org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):的错误
最近在使用mybatis时,出现了 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 这 ...
- IDEA异常解决: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
有时候解决问题不仅仅是解决问题.-----jstarseven 最近因为开发需要,需要搭建一个ssm开发框架,采用了开发工具IDEA. 整合完了SSM开发框架之后,发布的时候出现org.apache. ...
- 通过maven test 报org.apache.ibatis.binding.BindingException: Invalid bound statement
背景 直接使用eclipse工具去执行,没有问题,通过testng.xml去执行,没有问题,但通过mvn clean test执行,就报错,提示org.apache.ibatis.binding.Bi ...
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.e3mall.search.mapper.ItemMapper.getItemList
java.lang.RuntimeException: org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...
- 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),部 ...
随机推荐
- UWP FillRowViewPanel
最近有童鞋有这种需求,说实话我不知道这个Panel怎么起名字. 效果连接https://tuchong.com/tags/风光/ 下面是我做成的效果,可以规定每个Row的Items个数 2个 3个 4 ...
- pyqt5 Button.click 报错:argument 1 has unexpected type 'NoneType'
如上所示,在括号中,添加‘lambda:’,就可以成功运行,不知道为啥. 参考:https://blog.csdn.net/flhsxyz/article/details/79220936?utm_s ...
- Python入门 ---基础知识
Python入门不知道这些你还是承早放弃吧!真的 Python 简介 Python 是一个高层次的结合了解释性.编译性.互动性和面向对象的脚本语言. Python 的设计具有很强的可读性,相比其他语言 ...
- UVA12888 【Count LCM】(莫比乌斯反演)
题意:求\(\sum_{i=1}^{n}\sum_{j=1}^{m}[gcd(i,j)==1]\) \(assume\ n<m\) \(\sum_{i=1}^{n}\sum_{j=1}^{m}[ ...
- 13_python_内置函数
- python 多版本管理pyenv和virtualenv虚拟开发环境
pyenv是管理多个python版本的工具. 1.pyenv的安装 git clone https://github.com/yyuu/pyenv.git ~/.pyenv 2.将PYENV_ROOT ...
- centos7 系统优化
#!/usr/bin/env bash #设置环境变量 export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/u ...
- VirtualBox下Ubuntu虚拟机共享文件夹、自动挂载相关配置
VirtualBox Ubuntu 共享文件夹的自动挂载: 一些基本的操作步骤: 首先,我们想要实现VirtualBox虚拟机与windows系统之间的通信,我们必须也应该正确的安装虚拟机系统. 其次 ...
- zend studio 9.0.2 破解-注册-汉化流程
1.运行 ZendStudio-9.0.2.msi :注意安装后不要启动: 附其下载地址:下载9.0.2版本的Zend StudioZend Studio 9.0.2下载地址:http://www.g ...
- php -- 文件读写
----- 024-file.php ----- <!DOCTYPE html> <html> <head> <meta http-equiv="c ...