当mybatis整合spring后出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
来源:互联网 发布:网络文字编辑兼职 编辑:程序博客网 时间:2024/04/29 23:00
今天把项目所需的架包和配置配好后,运行项目, 却报出这个错误:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
com.dao.mapper.UserInfoMapper.countByExample at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:196) at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:44) at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:59) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52) at com.sun.proxy.$Proxy93.countByExample(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java
说我找不到这个dao接口的方法,可是我明明在写的都对应着,为什么找不到呢?
搜索了一下:对应的Dao和mapper.xml文件对应不上,所以就开始了更改的过程
首先是把dao接口和mapper里的配置文件名要一致:例如 UserDao.Java 和 UserDaoMapper.xml
第二就是 看 mapper.xml 里的namespace里对应的dao接口 写对没, 然后再看 在dao接口中的这个方法名是否和mapper.xml 里的ID对应, 然后点击保存。 重启了后试下, 问题 解除.
按照别人整合的解决方法是:
按以下步骤一一执行:
1:检查xml文件所在的package名称是否和interface对应的package名称一一对应
2:检查xml文件的namespace是否和xml文件的package名称一一对应
3:检查函数名称能否对应上
4:去掉xml文件中的中文注释
5:随意在xml文件中加一个空格或者空行然后保存
一般来说到此就可以排除错误了
希望大家不要出错哦,配置 真心感觉 是坑啊 一步错 就要花几个小时去找错。
0 0
- 当mybatis整合spring后出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- spring+mybatis整合报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
- mybatis整合springmvc时的错误org.apache.ibatis.binding.BindingException: Invalid bound statement (not found
- 关于整合SSH,出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- mybatis出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
- spring mybatis集成报错: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)
- 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)
- 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)
- 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)
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- Json数据解析在Unity3d中的应用
- 基本Docker zookeeper 3.4.9 集群搭建
- C语言中的函数与数学上的函数很类似
- ELK日志处理之使用Grok解析日志
- Java--Socket通信(双向)
- 当mybatis整合spring后出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- umount: /var: device is busy
- CodeForces
- android studio NDK开发环境设置
- js 获取json对象的Key、value
- 对称矩阵与稀疏矩阵(转置)
- Apache 映射磁盘路径,启动静态资源以实现动静分离
- 数字签名是什么?
- 服务器安全配置