背景

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

解决方法

首先先肯定的是:mybatis的配置是没有问题,因为eclipse可以正常执行;

在eclipse中把mapper的xml文件放到src代码目录下是可以一起打包进classes的,而maven去编译的时候不会,就会导致找不到xml报错。

  • 第一种,由于idea默认是不打包src中的xml文件,所以在eclipse中你可以把xml放到src中没有问题,但是在idea中,你把mapper的xml文件放到resources资源中就可以正常访问!
    这种的话由于代码调整比较大,不建议这样修改;

  • 第二种 在maven配置maven对资源文件的访问,具体做法:在pom中,build节点中加入

    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>true</filtering>
        </resource>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>true</filtering>
        </resource>
    </resources>

    maven在build的时候可以指定resources目录,就可以修复这个问题

转载于:https://www.cnblogs.com/jwentest/p/7113421.html

通过maven test 报org.apache.ibatis.binding.BindingException: Invalid bound statement相关推荐

  1. mybatis-plus自定义mapper报org.apache.ibatis.binding.BindingException: Invalid bound statement(not found)

    今天在springboot的项目中,需要用到自定义的mapper,之前一直使用mybatis-plus自动生成的mapper,一直可以正常使用,今天因为需求需要,自定义了mapper,但是一直报这个错 ...

  2. idea 报org.apache.ibatis.binding.BindingException: Invalid bound statement

    最近在整合ssm,真的是踩各种坑,记录一下 org.apache.ibatis.binding.BindingException: Invalid bound statement 一直报这个错,*Ma ...

  3. springboot整合Mybatis提示org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

    在用maven配置mybatis环境时出现此BindingExceptiony异常,发现在classes文件下没有mapper配置文件,应该是maven项目没有扫描到mapper包下的xml文件, 在 ...

  4. 解决:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

    之前有用过SSM框架,并且自己搭过,完全没问题.工作之后一直用maven,前两天在maven下搭建了一个SSM框架,但是一直报绑定失效错误,具体错误如下: org.apache.ibatis.bind ...

  5. 【踩坑】遇到 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 报错...

    今天在重做 iblog 客户端时,测试接口情况,发现了 org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...

  6. 报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)问题

    记录报错:解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)问题 在做毕设的时候,报了这 ...

  7. org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xxx.xxx 的解决办法

    问题概述 关于这个问题,博主是在团队成员搭建基础框架的时候遇到的,协助团队成员解决,这儿记录下来仅供参考, 基础架构搭建,接口链路调用时, 程序报错:" org.apache.ibatis. ...

  8. org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):的三种解决方式

    在使用mybatis-plus自定义SQL的时候,没有使用注解方式,而是将SQL语句写在mappper.xml文件中,就报了这个错:org.apache.ibatis.binding.BindingE ...

  9. org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

    1. 报错信息 前端500报错 后端 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): ...

  10. org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): dao.UserDao.selectU

    org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): dao.UserDao.selectU ...

最新文章

  1. LTE中基本通信过程的理解——上行调度
  2. ORACLE-删除同一字段中重复值函数
  3. 湖南c语言高考试卷及答案,2018年湖南省对口高考C语言试题(包含答案).docx
  4. 信息抽取(四)【NLP论文复现】Multi-head Selection和Deep Biaffine Attention在关系抽取中的实现和效果
  5. mysql使用某一列的内容赋值给另外一列,concat()函数
  6. spring(13)缓存数据
  7. java response 获得code_Java教程分享使用HttpClient抓取页面内容
  8. debian9为什么默认是pip2_VirtualBox内刚刚安装完Debian9系统,也无法设置共享文件夹。解决的方法就是安装VirtualBox客户端增强包。...
  9. python入门教程pdf-《python基础教程(第3版)》高清版PDF免费下载
  10. java菜单如何点解_解读java菜单
  11. matlab遗传算法工具箱的设计,MATLAB遗传算法工具箱的设计
  12. matlab绘制奈奎斯特图和伯德图
  13. neutron的dvr
  14. bat文件建文件夹时乱码及失败问题
  15. 程序框图计算机算法语言应用,数学之算法与程序框图
  16. Foxmail上Gmail打不开登录不了邮箱最新解决方法
  17. 【AviUtl】动画效果,简易Glitch++(派生),学习笔记
  18. matlab 高精度无理数,如何从MatLab上的无理数产生近似分数?
  19. 从titles表获取按照title进行分组,每组个数大于等于2,给出title以及对应的数目t。 注意对于重复的emp_no进行忽略。...
  20. 01-leveldb概述

热门文章

  1. qmessagebox 设置显示屏幕中间_windows7屏幕分辨率设置
  2. 木桶问题MATLAB,物理实验绪论-喻小强.ppt
  3. false在python什么意思_python – `x [False]`在numpy中做什么?
  4. Prototype使用Template
  5. 【渝粤教育】国家开放大学2018年春季 0266-21T设计构成 参考试题
  6. [渝粤教育] 中国地质大学 测量学 复习题
  7. Python进阶(零)字典、缺省参数、多值参数
  8. 上拉电阻与下拉电阻介绍
  9. 数据结构习题--用双队列模拟栈及用栈逆置队列
  10. C++,std::shared_future的使用