错误信息:
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