分析原因是mybatis的映射文件的问题,首先进行分析排查:

1.检查mapper接口和对应的xml文件的包名是否对应

2.检查xml文件的namespace与mapper接口的包名是否对应

3.检查mapper接口的函数名字与xml文件中的方法的id是否一致

4.如果是ssm整合工程的话,应该检查一下在spring-mybatis的配置文件applicationContext-dao.xml(这里的名字不唯一,这里是为了统一名字)有没有加载进web.xml中。

5.如果是普通的ssm项目,则这样配置:
<bean id="sqlSessionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="druidDataSource"/>
<property name="configLocation" value="classpath:mybatis-config.xml"/>
<!-- 配置mapper文件的位置 -->
<property name="mapperLocations" value="classpath:mapper/*.xml"/>
</bean>

一般的错误此时已经可以基本解决了。

如果还没有解决的话,我们可以考虑是xxxMapper.xml文件没有编译到classes文件中,或者是路径错误访问不到。

我们可以将xxxMapper.xml文件直接手动拖到对应的目录下,比如我将ItemMapper.xml拖到了classes中的与ItemMapper.class在一个目录,再次启动tomcat服务器就可以正常访问了。

这是一个治标不治本的方法,我们要从根本上找问题的话就是,我们在resources中创建目录用的方式是不对的。

 正确的方式应该是这样的:

要使用/ 来分割目录,使用点 . 来分割的话创建的目录就是一个名称为com.atyyc.ssm.dao的目录,所以mybatis访问的话,路径就错误了,这是一个创建包的小细节,圈起来。

使用maven整合mybatis时出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)的更多相关文章

  1. mybatis配置时出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

    如果出现: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因是Mapper i ...

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

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

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

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

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

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

  5. SSM整合junit单元测试之org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

    想用SSM做一点小测试,项目整合完毕,直接使用junit测试mybatis,出现如下错误(SuperTest类中进行了spring运行环境加载): 解决思路: 检查mapper接口与mapper.xm ...

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

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

  7. 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 ...

  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. 通过maven test 报org.apache.ibatis.binding.BindingException: Invalid bound statement

    背景 直接使用eclipse工具去执行,没有问题,通过testng.xml去执行,没有问题,但通过mvn clean test执行,就报错,提示org.apache.ibatis.binding.Bi ...

随机推荐

  1. e3mall商城总结13之订单确认(有BUG)

    说在前面的话 上一节说了购物车的生成,本节主要说了在购物车的列表上去结算,从而生成一个未支付的订单,生成的订单默认状态为1, 题目说的BUG是因为所有数据都是通过前端向后端生成的,包括订单的金额.因此 ...

  2. [ASP.NET Core开发实战]基础篇01 Startup

    Startup,顾名思义,就是启动类,用于配置ASP.NET Core应用的服务和请求管道. Startup有两个主要作用: 通过ConfigureServices方法配置应用的服务.服务是一个提供应 ...

  3. 【学习中】Fitness Schedule

    章节 内容 签到 第1周:步伐 √第1课(34分钟) 跑步1分钟 行走2分钟 共做8次 4月24日 √第2课(28分钟) 跑步1分钟 行走2分钟 共做6次 4月27日 √第3课(31分钟) 跑步1分钟 ...

  4. 理解WEB系统

    网络应用及分类 BS架构:Browser/Server web应用的客户端不需要安装以及升级维护 跨平台 较方便CS架构:Client/Server 客户端应用则需要每个客户端安装和升级 一种系统对应 ...

  5. CodeForces - 505B-Mr. Kitayuta's Colorful Graph(暴力)

    Mr. Kitayuta has just bought an undirected graph consisting of n vertices and medges. The vertices o ...

  6. PyTorch ResNet 使用与源码解析

    本章代码:https://github.com/zhangxiann/PyTorch_Practice/blob/master/lesson8/resnet_inference.py 这篇文章首先会简 ...

  7. 2020年1月31日 安装Python的BeautifulSoap库记录

    C:\Users\ufo>pip install beautifulsoup4 Collecting beautifulsoup4 WARNING: Retrying (Retry(total= ...

  8. 20190923-05Linux用户组管理命令 000 013

    每个用户都有一个用户组,系统可以对一个用户组中的所有用户进行集中管理.不同Linux 系统对用户组的规定有所不同, 如Linux下的用户属于与它同名的用户组,这个用户组在创建用户时同时创建. 用户组的 ...

  9. nginx安装第三方模块echo

    要使用第三方模块ngx_echo的功能,请重新配置添加到nginx插件中 ##下载第三方模块 wget https://github.com/openresty/echo-nginx-module/a ...

  10. 7.SwrContext音频重采样使用

    头文件位于#include <libswresample/swresample.h>   SwrContext常用函数如下所示 SwrContext *swr_alloc(void); / ...