【SSM】nested exception is org.apache.ibatis.binding.BindingException: Invalid boun原因总结

简介: 【SSM】nested exception is org.apache.ibatis.binding.BindingException: Invalid boun原因总结

今天在整合SSM框架时,遇到如下问题,尝试了网上很多方法,终于成功解决,相信以下方法可以解决大多数人的问题。


20191113115554491.png


排查方法如下:


1、mapper接口和mapper.xml是否在同一个包(package)下?名字是否一样(仅后缀不同)?


2、mapper.xml的命名空间(namespace)是否跟mapper接口的包名一致?


3、接口的方法名,与xml中的一条sql标签的id一致 (我个人是由于这个原因,在mapper.xml的配置文件中id与接口id没能一致,导致自己的insertUser方法出现问题!)


4、如果接口中的返回值List集合(不知道其他集合也是),那么xml里面的配置,尽量用resultMap(保证resultMap配置正确),不要用resultType


5、如果你的项目是maven项目,请你在编译后,到接口所在target目录看一看,很有可能是没有mapper生产对应的xml文件,因为maven默认是不编译的,因此,你需要在你的pom.xml的里面,加这么一段:

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



目录
相关文章
|
7月前
|
SQL Java 数据库连接
【问题解决】nested exception is org.apache.ibatis.exceptions.TooManyResultException:Expected one result
【问题解决】nested exception is org.apache.ibatis.exceptions.TooManyResultException:Expected one result
|
6月前
|
XML Java 数据库连接
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):XXXXX
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):XXXXX
|
5月前
|
Java 数据库连接 mybatis
Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid
Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid
|
6月前
|
Java
Exception in thread “main“ org.apache.ibatis.exceptions.PersistenceException:
Exception in thread “main“ org.apache.ibatis.exceptions.PersistenceException:
|
7月前
|
XML Java 数据库连接
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.forum.d
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.forum.d
65 1
|
6月前
|
Java 数据库连接 mybatis
【已解决】nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘qcBizname‘ not found
【已解决】nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘qcBizname‘ not found
183 0
|
Java Apache Maven
【异常解决】Handler dispatch failed;nested exception is java.lang.NoClassDefFoundError: org/apache/common
【异常解决】Handler dispatch failed;nested exception is java.lang.NoClassDefFoundError: org/apache/common
3825 0
|
7月前
|
前端开发 Java 数据库连接
若依 mybatis报错nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘XXX‘ 错误
若依 mybatis报错nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘XXX‘ 错误
135 0
|
7月前
|
Java Spring
上传文件出现 aximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.
上传文件出现 aximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.
61 0
org.apache.ibatis.builder.BuilderException: An invalid property ‘jdbcType ‘ was found in mapping
org.apache.ibatis.builder.BuilderException: An invalid property ‘jdbcType ‘ was found in mapping
101 0

推荐镜像

更多