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

 

异常

在测试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文件添加如下内容:

[html] view plain copy
  1. <!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->  
  2.     <build>  
  3.         <resources>  
  4.             <resource>  
  5.                 <directory>src/main/java</directory>  
  6.                 <includes>  
  7.                     <include>**/*.properties</include>  
  8.                     <include>**/*.xml</include>  
  9.                 </includes>  
  10.                 <filtering>false</filtering>  
  11.             </resource>  
  12.         </resources>  
  13.     </build>  

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

原文作者
http://blog.csdn.net/Evan_Leung/article/details/50670780

相关文章: