在使用maven做mybatis项目时会遇到这个问题,

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

原因:

1.使用原始方式开发时缺少接口的实现类。

2.使用代理开发时少映射的xml文件。

我遇到这个问题时使用的是代理开发,然而我是有映射的xml文件的呀

这里遵从代理开发的一个原则,映射类和对应的xml文件应该在同一个包中,编译之后我们看一下结果

没有看到xml文件,这就是报异常的原因啦。

使用maven的话还需要进行一个配置,因为maven只会处理resources中的配置文件,而mapper的xml文件是在java文件夹中的,所以被maven忽略掉了

解决mapper映射文件不拷贝的问题

需要修改dao工程的pom文件。添加如下内容:

<!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
<build>
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>false</filtering>
        </resource>
    </resources>
</build>

把src/main/java下的*.properties和*.xml配置文件都放在resources中。

maven项目:Invalid bound statement的更多相关文章

  1. 解决maven项目Invalid bound statement (not found)的方法

    用IDEA 做的ssm 的maven项目,登陆时出现上图问题. 原因是它读取不到DevUserMapper.xml文件和取它xml文件,后面查询在编译好的文件中,xml文件并没有引入进来,这就是导致出 ...

  2. eclipse java项目转idea java项目Invalid bound statement (not found): com.mapper 报错问题

    再pom文件中加上 <build> <resources> <resource> <directory>src/main/java</direct ...

  3. springboot项目Invalid bound statement (not found): com.xxxx.dao.xxxDAO.xxx解决方法

    1.首先判断自己的Dao和mapper的对应关系,注意要一一对应的. 2.配置信息出现问题,注意配置信息填写: 3.记住要细心细心,细心,重要的事情说三遍.

  4. 转载:Maven项目mybatis Invalid bound statement (not found)解决方法

    在mapper代理的开发中,程序员需要遵守一些规范,mybatis才能实现mapper接口的代理对象. 它的规范如下: mapper.xml的namespace要写所映射接口的全称类名. mapper ...

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

    ssm的项目如果在mapper.xml  mapper接口 配置没问题的情况下  项目依然报org.apache.ibatis.binding.BindingException: Invalid bo ...

  6. Maven项目mybatis Invalid bound statement (not found)解决方法

    最近因为工作需要,要学习mybatis框架.在添加好一些依赖之后,通过mybatis进行数据库的crud操作.但是在测试的时候总是报mybatis:Invalid bound statement (n ...

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

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

  8. Invalid bound statement (not found)之idea打包maven项目问题

    开发的一个maven项目,之前在Eclipse中,maven打包部署完后一切正常,后来转到idea中开发,再用maven打包部署后, 一直报 Invalid bound statement (not ...

  9. 项目启动报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.wuhongyu.mapper.OrdersMapper.selectByExample

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

随机推荐

  1. Linq to Entities

    首先要添加一个ADO.NET实体数据模型 添加一个Entities 对象,其用法和linqtosql类似例如: StudentInfoEntities2 entity = new StudentInf ...

  2. 每日一“酷”之textwrap

    介绍:需要美观打印时,可以使用textwrap模块来格式化要输出的文本,这个模块允许通过编程提高类似段落自动换行或填充特性等功能. 1 创建实例数据 sample_text = ''' I’m ver ...

  3. 【正则】精通JS正则表达式,没消化 信息量太大,好文

    http://www.jb51.net/article/25313.htm 正则表达式可以: •测试字符串的某个模式.例如,可以对一个输入字符串进行测试,看在该字符串是否存在一个电话号码模式或一个信用 ...

  4. Jira 6.0.3 安装与破解

    如果你还没有使用Jira做项目跟踪与管理,那就赶紧试用一下吧.下面教你一步一步安装Jira 6.0.3,以及如何破解试用版. 一. 安装准备   1. 去Jira官方网站下载http://www.at ...

  5. 在iOS App的图标上显示版本信息

    最近读到一篇文章(http://www.merowing.info/2013/03/overlaying-application-version-on-top-of-your-icon/)介绍了一种非 ...

  6. backup site collection

    http://stackoverflow.com/questions/5376380/sharepoint-2010-change-sitecollection-urlstsadm -o backup ...

  7. Codeforces Round #311 (Div. 2) D. Vitaly and Cycle 奇环

    题目链接: 点这里 题目 D. Vitaly and Cycle time limit per test1 second memory limit per test256 megabytes inpu ...

  8. firefox同步ajax请求报错的问题 A parameter or an operation is not supported by the underlying object

    今天在测试系统时,一个很正常的功能在firefox下报错,经过验证在ie和chrome浏览器中功能这个正常.   调试后发现: 请求比其他请求的特殊点在于同步请求.   经过firefox的控制台上测 ...

  9. Hadoop以及其外围生态系统的安装参考

    在研究Hadoop的过程中使用到的参考文档:   1.Hadoop2.2 参考文档 在CentOS上安装Hadoop 2.x 集群: http://cn.soulmachine.me/blog/201 ...

  10. struts文件上传拦截器maximumSize设置文件大小不起作用

    <interceptor-ref name="fileUpload">                <param name="allowedTypes ...