一、异常信息

Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.hand.hec.nghec.sys.mapper.SysServiceMapper.selectService
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.$Proxy169.selectService(Unknown Source)
at com.hand.hec.nghec.sys.service.impl.SysServiceServiceImpl.select(SysServiceServiceImpl.java:26)
at com.hand.hec.nghec.sys.service.impl.SysServiceServiceImpl.select(SysServiceServiceImpl.java:1)
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:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at com.hand.hap.core.impl.ServiceExecutionAdvice.invoke(ServiceExecutionAdvice.java:169)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy170.select(Unknown Source)
at com.hand.hap.system.controllers.BaseController.query(BaseController.java:68)

二、异常原因

一般的原因是Mapper interface和xml文件的定义对应不上,

需要检查包名,namespace,函数名称等能否对应上,

需要比较细致的对比,我经常就是写错了一两个字母搞的很长时间找不到错误

三、异常解决过程

1.常见解决方法

出现这个错误时,按以下步骤检查一般就会解决问题:

1:检查xml文件所在的package名称是否和interface对应的package名称一一对应

2:检查xml文件的namespace是否和xml文件的package名称一一对应

3:检查函数名称能否对应上

4:去掉xml文件中的中文注释

5:随意在xml文件中加一个空格或者空行然后保存

一般来说到此就可以排除错误了

2.我的原因与解决方法

(1)原因

原因还是因为Mapper interface和xml文件的定义对应不上

这是因为我一个web工程依赖了两个jar工程,而这两个jar工程 mapper.xml文件的目录结构相似,并且映射路径也相同,这导致mybatis只扫描了其中一个jar工程的xml,而不扫描另一个的。

applicationContext.xml

jar工程1目录:

jar工程2目录:

 (2)解决方法

修改applicationContext.xml 中 mapper文件映射路径:

写成两个就可以了

(3)存疑

如上述配置文件中,mybatis  一个 value  只扫一个工程的。 所以要为每个工程单独配置一个value.

四、参考资料

1.mybatis绑定错误-- Invalid bound statement (not found)

Mybatis异常_03_Invalid bound statement (not found)的更多相关文章

  1. Mybatis异常_01_Invalid bound statement (not found)

    异常信息:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.taotao.map ...

  2. 解决Mybatis的invalid bound statement (not found)异常

    使用Maven构建SSM时, 需要在pom.xml中配置一些信息, 否则mapper.xml就无法被扫描到, 程序就会抛invalid bound statement (not found)异常 解决 ...

  3. mybatis-plus 异常 Invalid bound statement (not found)

    最近吧项目中添加使用了mybatis-plus,发现操作sql的时候出现异常: Invalid bound statement (not found) ,异常位置位于mybatis-plus的jar中 ...

  4. mybatis:Invalid bound statement (not found)

    [常规解决办法] 如果出现: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因 ...

  5. MyBatis错误--Invalid bound statement (not found)

    今天在开发项目的时候使用MyBatis发生错误:Invalid bound statement (not found) 具体错误信息: org.springframework.beans.factor ...

  6. mybatis错误Invalid bound statement (not found) 的解决办法

    <!-- IDEA需要添加一下内容,否则无法找到mapper --> <build> <resources> <resource> <direct ...

  7. myBatis中Invalid bound statement (not found)错误

    环境:Idea.ssm.maven 由于使用maven的原因,maven不会扫描到mapper的xml文件所以会出现此类问题. 每次走到mapper方法时就抛异常:Invalid bound stat ...

  8. mybatis 报Invalid bound statement(not found) 和 Property 'mapperLocations' was not specified or not matching resources found

    排除问题的步骤: 1.首先检查mapper文件和mapper接口的文件名是否相等. 2.pom.xml是否把xml排除了,这样写就会src/main/java下所有的Mybatis的xml文件都删除, ...

  9. mybatis BindingException: Invalid bound statement (not found)

    错误截图 解决措施 此异常的原因是由于mapper接口编译后在同一个目录下没有找到mapper映射文件而出现的. 通常我们在配置SqlSessionFactory时会有如配置 <!-- 配置Sq ...

随机推荐

  1. 聊聊高并发(三十九)解析java.util.concurrent各个组件(十五) 理解ExecutorService接口的设计

    上一篇讲了Executor接口的设计,目的是将任务的运行和任务的提交解耦.能够隐藏任务的运行策略.这篇说说ExecutorService接口.它扩展了Executor接口,对Executor的生命周期 ...

  2. Lua学习一----------开发环境搭建

    © 版权声明:本文为博主原创文章,转载请注明出处 1.LuaDist下载地址:http://luadist.org/ 2.LuaRocks下载地址:https://github.com/luarock ...

  3. MVC项目总结

    View命名 View下有多个模块的文件夹,我们根据微软的规定,每个模块下的首页都为Index.cshtml命名 获得当前页面的控制器名称 var currentControllerName = th ...

  4. cacti 安装和组件添加

    安装cacti 步骤 1.准备lamp环境 2.准备所需包:rrdtool(绘图) cacti(安装程序) net-snmpd(数据收集) 3.安装所需库文件 rrdtool所需库文件有: cairo ...

  5. Ejabberd作为推送服务的优化手段(转)

    AVOS Cloud目前还在用Ejabberd做Android的消息推送服务.当时选择Ejabberd,是因为Ejabberd是一个发展很长时间的XMPP实现,并且基于Erlang,设想能在我们自主研 ...

  6. 【Scala】Scala的Predef对象

    隐式引用(Implicit Import) Scala会自己主动为每一个程序加上几个隐式引用,就像Java程序会自己主动加上java.lang包一样. Scala中.下面三个包的内容会隐式引用到每一个 ...

  7. programming review (c++): (1)vector, linked list, stack, queue, map, string, bit manipulation

    编程题常用知识点的review. most important: 想好(1)详尽步骤(2)边界特例,再开始写代码. I.vector #include <iostream> //0.头文件 ...

  8. Error -27728: Step download timeout (120 seconds)的解决方法(转)

    LR中超时问题解决方法 超时错误在LoadRunner录制Web协议脚本回放时超时经常出现. 现象1:Action.c(16): Error -27728: Step download timeout ...

  9. 修改linux的hostname (修改linux系统的IP和hostname)

    # vi /etc/sysconfig/networkNETWORKING=yesHOSTNAME=yourname //在这修改hostnameNISDOMAIN=eng-cn.platform.c ...

  10. 九度OJ 1024:畅通工程 (最小生成树)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3979 解决:1354 题目描述:     省政府"畅通工程"的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有 ...