欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Eclipse下,Maven打包时忽略src路径下xml文件的问题

程序员文章站 2022-07-12 18:30:51
...
javax.xml.ws.soap.SOAPFaultException: Invalid bound statement (not found)...

运行时错误:
javax.xml.ws.soap.SOAPFaultException: Invalid bound statement (not found)


原因:
    一般发生在spring+mybatis的整合中,maven默认是不打包src下xml、properties等配置文件的,部署的war包中并没有mybatis要用的的.xml文件,导致sqlSessionFactory里面未注册实体所需的接口、sql语句等引起。

解决方案:
    去pom文件的build元素下,添加这样一段代码:
       <resources>  
           <resource>  
               <directory>src/main/java</directory>  
               <includes>  
                   <include>**/*.xml</include>  
                   <include>**/*.properties</include>  
               </includes>  
               <filtering>false</filtering>  
           </resource>  
            <resource>    
               <directory>src/main/resources</directory>    
               <includes>  
                   <include>**/*.xml</include>  
                   <include>**/*.properties</include>  
               </includes>  
               <filtering>false</filtering>  
           </resource>  
       </resources>