Result Maps collection already contains value for com.liuyanzhao.ssm.mapper.Items的原因及解决办法

Caused by: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.mapper.PetMapper.BaseResultMap
 at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:97)
 at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:73)
 at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:255)
 at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:83)
 ... 5 more
Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.mapper.PetMapper.BaseResultMap
 at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:578)
 at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:551)
 at org.apache.ibatis.session.Configuration.addResultMap(Configuration.java:356)
 at org.apache.ibatis.builder.MapperBuilderAssistant.addResultMap(MapperBuilderAssistant.java:138)
 at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:231)
 at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:201)
 at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:196)


 at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.Java:93)
  原因是在使用 mybatis 逆向工程生成代码的时候多次重复生成,导致配置配件多次重复积累,解决办法是把逆向工程里面的代码删除掉,然后再点击运行一次,刷新看到代码即可,然后再拷到新工程里面,这样在运行 web 项目就 ok 了   本文链接:https://liuyanzhao.com/5938.html

发表评论

目前评论:2