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



目录
相关文章
|
1月前
|
SQL Java 数据库连接
【问题解决】nested exception is org.apache.ibatis.exceptions.TooManyResultException:Expected one result
【问题解决】nested exception is org.apache.ibatis.exceptions.TooManyResultException:Expected one result
|
28天前
|
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.
10 0
|
6月前
|
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
1129 0
|
6月前
|
Java 数据库连接 mybatis
【Mybatis异常】nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter
【Mybatis异常】nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter
178 0
|
9月前
|
SQL Java 数据库连接
nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘‘ not found. Ava
用mybatis写注解SQL的执行报错,这个报错有很多原因就不说了,说一下我的问题 同一个mapper中方法有重名的,虽然编译没报错,相当于重载了,但是执行的时候就报错了 方法写的太多了都没注意
|
10月前
|
XML Java 数据库连接
nested exception is org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps
nested exception is org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps
118 0
|
Java 应用服务中间件 Apache
nested exception is java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntim
nested exception is java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntim
250 0
|
Java 数据库连接 mybatis
【异常】nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘ids‘ not found.
nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘ids‘ not found.
295 0
|
资源调度 容器
yarn 导出日志报错Exception in thread “main“ org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException
yarn 导出日志报错Exception in thread “main“ org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException
|
资源调度
yarn导出日志报错:Exception in thread "main" org.apache.hadoop.yarn.exception.ApplicationNotFoundException
yarn导出日志报错:Exception in thread "main" org.apache.hadoop.yarn.exception.ApplicationNotFoundException
yarn导出日志报错:Exception in thread "main" org.apache.hadoop.yarn.exception.ApplicationNotFoundException

热门文章

最新文章

推荐镜像

更多