ssm项目dao层方法异常:org.apache.ibatis.binding.BindingException: Invalid bound statement
在IntelliJ IDEA中用ssm框架搭建了一个demo项目,在执行到dao层方法时抛出这个异常:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.monolog.diana.dao.StatisticsDao.clear
第一反应是mapper的名称空间没有跟dao关联,或者dao的方法名和mapper的id不匹配。但是检查了一遍,没有这个问题。然后发现target目录下面并没有编译后的mapper文件。在网上搜了一下,有大神建议在pom文件的<build><resources></resources></build>标签下,将mapper的路径添加进去。类似于这样:
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
大概思路就是编译的时候告诉maven哪些是配置文件。
另外还有一种方式,因为我的pom文件本来是这样的:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
... <!--项目搭建-->
<build>
<!--打包用名-->
<finalName>diana.web</finalName>
<!--插件-->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
<!--配置文件-->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
即已经指定了配置文件的位置:src/main/resources,那么我把mapper文件扔到resources目录下(而不是java目录下)就可以了,类似于这样:

ssm项目dao层方法异常:org.apache.ibatis.binding.BindingException: Invalid bound statement的更多相关文章
- 异常 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 解决方案
原来是因为 AssetsMapper.xml 不知道为什么不见了,导致这个异常,在启动项目时的启动任务里调用到了它,然后因为没有这个xml,所以抛出异常 启动信息: C:\extend\Develop ...
- Spring扫面路径配置不全导致异常 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 的原因
运行Junit测试类 package cn.bgodata.x.zero.service; import org.junit.Test; import org.junit.runner.RunWith ...
- Maven项目使用mybatis报错 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
maven项目使用mybatis时,找不到mapper文件(.xml) 错误信息提示: 项目可以正常运行,但是在有请求到达服务器时(有访问数据库的请求),会出现报错!! 错误原因: mybatis没有 ...
- Java报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.sirifeng.babytun.dao.GoodsDAO.findById
前言 最近学vue学得差不多了,想来搭个项目实战一下,结果刚开始搭建SSM框架的时候就来到了我们最喜欢的debug环节 org.apache.ibatis.binding.BindingExcepti ...
- IDEA异常解决: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
有时候解决问题不仅仅是解决问题.-----jstarseven 最近因为开发需要,需要搭建一个ssm开发框架,采用了开发工具IDEA. 整合完了SSM开发框架之后,发布的时候出现org.apache. ...
- maven项目 报错 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
ssm的项目如果在mapper.xml mapper接口 配置没问题的情况下 项目依然报org.apache.ibatis.binding.BindingException: Invalid bo ...
- 【spring boot Mybatis】报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.newhope.interview.dao.UserMapper.add
报错如下: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.newhope.i ...
- 解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xyfer.dao.UserDao.findById
在使用Spring整合MyBatis的时候遇到控制台报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (no ...
- 关于org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.crud.dao.DepartmentMapper.insertSelective的错误
今天我在使用mybatis逆向工程的时候,由于一个疏忽字打错了..结果花了一早上才把错误找全..广大小伙伴们一定要小心啊(能复制粘贴就别手打) 关于org.apache.ibatis.binding. ...
随机推荐
- help_topic表,以字符拆分,一行转多行
help_topic表是数据库mysql下的一个表 SUBSTRING_INDEX(s, delimiter, number) 返回从字符串 s 的第 number 个 ...
- jfinal layui easyexcel 实现文件的上传下载
jfinal layui easyexcel 这三样开源技术这里就不多介绍了,自行百度了解吧,他们的组合算是一个很高效又不失美观的操作体验. 操作主要分以下几步: 1.建立jfinal的操作环境, ...
- 工具使用——VMware安装及使用
一.VMware的安装 本文使用VMware 14 pro,双击打开安装包,点击下一步: 选中我接受许可协议中的条款,点击下一步: 选择安装路径,点击下一步: 点击下一步: 点击下一步: 点击安装: ...
- Centos7下lvs负载均衡lvs-tun模式配置
一.架构 director:172.28.18.69 vip:172.28.18.70 real server1:172.28.18.71 real server2:172.28.18.78 二.两台 ...
- Java基本的程序结构设计 大数操作
大数操作 BigInteger 不可变的任意精度的整数.所有操作中,都以二进制补码形式表示 BigInteger(如 Java 的基本整数类型).BigInteger 提供所有 Java 的基本整数操 ...
- git 分支 版本回退
本地回退: git reset --hard HEAD~ 回退后推送到远程: git push --force .
- Shiro(二)
1 Shiro的授权 1.1 授权流程 1.2 授权方式 shiro支持三种方式的授权 1.2.1 编程式 通过编写if/else完成授权代码. if(subject.hasRole("ro ...
- redis高可用(一)主从复制
主从复制 读写分离 https://blog.csdn.net/u014691098/article/details/82391608
- keras学习笔记-bili莫烦
一.keras的backend设置 有两种方式: 1.修改JSON配置文件 修改~/.keras/keras.json文件内容为: { "iamge_dim_ordering":& ...
- 2018百度之星初赛A轮 度度熊学队列
注意:刚开始用数组存deque<int> qa[MAX]会爆内存 需要改用map<int, deque<int> > qa优化 不明觉厉 #include<b ...