错误异常:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.test.dao.NarCodeMapper.getNarCode

出现这个原因:Mybatis的Mapper interface和xml文件的定义对应不上

大致通过如下几步来检查:

1.Mapper interface(接口)名称和Mapper xml名称是否保持一致

-------------------------------------------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
  PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
  <mappers>
    <mapper resource="com/test/xml/NarCodeMapper.xml"/>
  </mappers>
</configuration>

-----------------------------------------------------------

package com.test.dao;

public interface NarCodeMapper {
 
}

-------------------------------------------------------------------------------------------------------------------------------------------------------

2.Mapper xml中namespace属性值是否和Mapper interface(接口)所在(package名称+接口名称)保持一致。(本人就是在这里大意)

-------------------------------------------------------------------------------------------------------------------------------------------------------

<mapper namespace="com.test.dao.NarCodeMapper">

</mapper>

-----------------------------------------------------------

package com.test.dao;

public interface NarCodeMapper {
 
}

-------------------------------------------------------------------------------------------------------------------------------------------------------

3.Mapper interface(接口)中的函数是否与Mapper xml中(select,update,insert,delete)标签中的id属性值对应

4.去掉xml文件中文注释

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

Mybatis笔记二:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)的更多相关文章

  1. mybatis使用时org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):的错误

    最近在使用mybatis时,出现了 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 这 ...

  2. mybatis错误之org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

    玩了MyBatis差不多有两年了,中间也玩过MyBatis-Plus,这个MyBatis-Plus其实与MyBatis的区别并不大.今天写博客业务代码的时候,犯一个初学者犯过的错误. 错误信息如下:o ...

  3. Maven项目使用mybatis报错 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

    maven项目使用mybatis时,找不到mapper文件(.xml) 错误信息提示: 项目可以正常运行,但是在有请求到达服务器时(有访问数据库的请求),会出现报错!! 错误原因: mybatis没有 ...

  4. 使用maven整合mybatis时出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

    分析原因是mybatis的映射文件的问题,首先进行分析排查: 1.检查mapper接口和对应的xml文件的包名是否对应 2.检查xml文件的namespace与mapper接口的包名是否对应 3.检查 ...

  5. maven 项目报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)解决

    idea在使用maven构建的项目中使用mybatis时报错org.apache.ibatis.binding.BindingException: Invalid bound statement (n ...

  6. MyBatis笔记----报错Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.ij34.model.UserMapper.selectUser

    信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@41cf53f9: startup ...

  7. MyBatis笔记----报错:Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)解决方法

    报错 Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound st ...

  8. 解决 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 以及MyBatis批量加载xml映射文件的方式

    错误 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 的出现,意味着项目需要xml文件来 ...

  9. Spring boot结合mybatis开发的报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

    错误:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found),经过排查确定是没有找到xml的原因 ...

随机推荐

  1. [NOIp2018]货币系统 背包

    LG传送门 完全背包板子题 显然就是判断有多少种面值的货币可以被其他面值的货币表示,完全背包搞一搞就好了. 考场代码(一看这两格缩进就知道是考场代码): #include<cstdio> ...

  2. 9.15 DP合集水表

    9.15 DP合集水表 显然难了一些啊. 凸多边形的三角剖分 瞄了一眼题解. 和蛤蛤的烦恼一样,裸的区间dp. 设f[i][j]表示i~j的点三角剖分最小代价. 显然\(f[i][i+1]=0,f[i ...

  3. sqlite两表更新update

    1 2 3 4 5 6 7 8 9 10 11 12 UPDATE t1 SET Column1 =   ( SELECT Columnx    FROM t2    WHERE t2. KEY = ...

  4. Unity3D:Text在Inspector面板中中无法显示,需转换成UTF-8格式

    环境:Win10 读取text内容后unity报错:Input string was not in the correct format 同时在Inspector面板中无法预览Text文本内容 随后发 ...

  5. SQL语句--连接查询

    一.连接查询有以下几种 1.内连接查询 select * from t1 inner join t2 on t1.x = t2.x;  返回有关联的行 2.外链接查询 以下写法都省略了 中间的 out ...

  6. Gradle初使用

    我以前一直使用Maven来构建工程,这两天突然发现gradle也非常好用,记录一下自己使用gradle的过程. Gradle的下载与配置 本次选择下载的是gradle3.5版本,没选最新的gradle ...

  7. Table Tennis Game 2(找规律)

    Description Misha and Vanya have played several table tennis sets. Each set consists of several serv ...

  8. C++:构造函数1——普通构造函数

    前言:构造函数是C+中很重要的一个概念,这里对其知识进行一个简单的总结 一.构造函数的定义 1.类中的构造函数名与类名必须相同 2.构造函数没有函数的返回类值型说明符 [特别注意]: a.构造函数的返 ...

  9. Ubuntu16.04下安装显卡驱动记录

    安装环境及硬件信息 Ubuntu16.04 LTS 内核版本:4.4.0 显卡:Nvidia GeForce GTX 1060 安装过程 一.首先要下载好显卡驱动程序,官方网址:http://www. ...

  10. P4语法(4)Control block

    Control block Control block之中用于放置设计好的Table和Action. 可以把control block认为是pipeline的一个模板,之前用的v1model中就是in ...