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

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> 





你可能感兴趣的:(eclipse,spring,maven,xml,mybatis)