报错:NestedIOException: Failed to parse mapping resource

报错:NestedIOException: Failed to parse mapping resource
详细信息如下:

BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; 
nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [F:\SpringBoot-ES-JerseyRESTful-Redis-Blog\MyBlog-Code\springboot-test-myblog\target\classes\mybatis\ArticleInfoMapper.xml]'; 
nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. 
The XML location is 'file [F:\springboot-test-myblog\target\classes\mybatis\ArticleInfoMapper.xml]'. 
Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.lvshuy.myblog.dao.ArticleInfoMapper.BaseResultMap
-------------省略了部分信息---------------------
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [F:\SpringBoot-ES-JerseyRESTful-Redis-Blog\MyBlog-Code\springboot-test-myblog\target\classes\mybatis\ArticleInfoMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.lvshuy.myblog.dao.ArticleInfoMapper.BaseResultMap
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:122)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:94)
	at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:532)
	... 39 common frames omitted
Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.lvshuy.myblog.dao.ArticleInfoMapper.BaseResultMap
	at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:930)
	at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:887)
	at org.apache.ibatis.session.Configuration.addResultMap(Configuration.java:644)
	at org.apache.ibatis.builder.MapperBuilderAssistant.addResultMap(MapperBuilderAssistant.java:208)
	at org.apache.ibatis.builder.ResultMapResolver.resolve(ResultMapResolver.java:47)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:289)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:253)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:245)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
	... 41 common frames omitted

Process finished with exit code 0

抽取错误信息:

BuilderException: Error parsing Mapper XML. The XML location is 'file [ArticleInfoMapper.xml]'. 
Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for BaseResultMap
IllegalArgumentException: Result Maps collection already contains value for com.lvshuy.myblog.dao.ArticleInfoMapper.BaseResultMap

解决办法:
因为使用Mybatis Generator逆向生成代码,运行了多次而重复生成了Result Maps,把所有生成的东西删掉,再次生成就可以了。

你可能感兴趣的:(SpringBoot)