非常規解決方案之Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value


1 前言

本地項目打包正常,放到服務器(Ubuntu18.04)運行出現錯誤。

URL [jar:file:/root/depoly/example-api.jar!/BOOT-INF/lib/example-common-2.5.0.jar!/mapper/vd/InstanceDao.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'URL [jar:file:/root/depoly/example-api.jar!/BOOT-INF/lib/example-common-2.5.0.jar!/mapper/vd/InstanceDao.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.example.modules.vd.dao.InstanceDao.InstanceMap

 

2 解決方案

根據網上查找,按照提示是InstanceMap重復,但是查找工程,並沒有重復,而且本地編譯也是正常。

<mapper namespace="com.example.modules.vd.dao.InstanceDAO">
//屏蔽resultMap
    <!--<resultMap type="com.example.modules.vd.entity.InstanceEntity" id="InstanceMap">-->
        <!--<result property="id" column="id"/>-->
        <!--<result property="code" column="code"/>-->
        <!--<result property="status" column="status"/>-->
        <!--<result property="creator" column="creator"/>-->
        <!--<result property="createDate" column="create_date"/>-->
        <!--<result property="updateDate" column="update_date"/>-->
    <!--</resultMap>-->

</mapper>

屏蔽resultMap后再編譯放到服務器再運行就ok了。

p.s. 這是比較神奇的bug及神奇的解決方案。

 

3 小結

后續若查到真正原因,待更新。

 


免責聲明!

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



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