Invalid bound statement (not found): com.taotao.mapper.TbItemMapper.selectByExample: 錯誤


在Maven工程下,想通過controller接收url中的參數Id查詢數據庫的數據,並且以json形式顯示在頁面。

在瀏覽器輸入url后出現的問題:

八月 22, 2016 1:45:22 下午 org.apache.catalina.core.StandardWrapperValve invoke
嚴重: Servlet.service() for servlet [taotao-manager] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.taotao.mapper.TbItemMapper.selectByExample] with root cause
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.taotao.mapper.TbItemMapper.selectByExample
 at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:189)
 at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:43)
 at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:58)
 at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:51)
 at com.sun.proxy.$Proxy30.selectByExample(Unknown Source)

 

原因:找不到mapper的映射文件

 

 

解決辦法:

 <!-- 如果不添加此節點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工程下的父工程里面pom.xml文件中

抱歉,我只能根據自己出現的情況說明了,希望能幫到出現同樣錯誤的朋友,同時希望路過的牛人指點。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM