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 小結
后續若查到真正原因,待更新。