Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already

衣舞晨風發表於2016-07-08

錯誤資訊:

Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for org.hc.jiankunking.system.member.dao.OrderLogMapper.BaseResultMap; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in file [E:\16年檔案\JAVAdemo\jiankunking\jiankunking-web\target\jiankunking-web-1.0-SNAPSHOT\WEB-INF\classes\spring\spring-mybatis.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'URL [jar:file:/E:/16年檔案/JAVAdemo/jiankunking/jiankunking-web/target/jiankunking-web-1.0-SNAPSHOT/WEB-INF/lib/jiankunking-system-1.0-SNAPSHOT.jar!/mapper/OrderLogMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for org.hc.jiankunking.system.member.dao.OrderLogMapper.BaseResultMap 

分析:

從錯誤提示資訊中可以看出,應該是OrderLogMapper.xml檔案有重複,mybatis識別不出來應該使用哪一個。

先在原始碼中看一下,發現沒有重複;然後到錯誤提示資訊中指明的:target/jiankunking-web-1.0-SNAPSHOT/WEB-INF/lib/jiankunking-system-1.0-SNAPSHOT.jar資料夾下搜尋一下,結果發現:


OrderLogMapper.xml真的有重複。

解決:

最簡單的方法就是直接刪除target檔案目錄下所有檔案即可,再次啟動idea的時候會重新生成。


作者:jiankunking 出處:http://blog.csdn.net/jiankunking


相關文章