Exception:Request processing failed; nested exception is org.apache.ibatis.binding.BindingException

时间:2021-04-26 19:22:31

异常

在测试Spring MVC+Mybatis整合时,运行 Maven build -> tomcat7:Run 遇到如下异常

Exception:Request processing failed; nested exception is org.apache.ibatis.binding.BindingException

从异常信息上看,是找不到mapper对应的xml文件,于是我到target目录去查找,是否存在mapper对应的xml文件,发现xml 文件并不在target目录下

Exception:Request processing failed; nested exception is org.apache.ibatis.binding.BindingException

解决方案

修改easybuy-manager-mapper的pom文件

Exception:Request processing failed; nested exception is org.apache.ibatis.binding.BindingException

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

这样就可以让Maven build字节码时把资源文件也一起生成.