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