Mapped Statements collection already contains value for ***.***的问题

 情景,在我们配置项目或者开发的过程中,可能由于项目工程量大或误操作等原因,造成Map映射文件的ID重复,造成项目启动报以下错误,

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory4' defined in ServletContext resource [/WEB-INF/spring/spring-mybatis_bhbank.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps\InteLZ\WEB-INF\classes\META-INF\mybatis\oracle\bhbank\mapping\map55\QUR_BANK_ID.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for QUR_BANK_ID.queryList
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) ~[spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ~[spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) ~[spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) ~[spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) ~[spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:684) ~[spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760) ~[spring-context-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) ~[spring-context-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) ~[spring-web-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) ~[spring-web-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at cn.com.yitong.ares.core.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:21) [ContextLoaderListener.class:na]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973) [catalina.jar:7.0.52]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467) [catalina.jar:7.0.52]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.52]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [catalina.jar:7.0.52]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [catalina.jar:7.0.52]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_152]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_152]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_152]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_152]
Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps\InteLZ\WEB-INF\classes\META-INF\mybatis\oracle\bhbank\mapping\map55\QUR_BANK_ID.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for QUR_BANK_ID.queryList
    at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:412) ~[mybatis-spring-1.1.1.jar:1.1.1]
    at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:295) ~[mybatis-spring-1.1.1.jar:1.1.1]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612) ~[spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549) ~[spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
    ... 22 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for QUR_BANK_ID.queryList
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92) ~[mybatis-3.2.7.jar:3.2.7]
    at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:410) ~[mybatis-spring-1.1.1.jar:1.1.1]
    ... 25 common frames omitted
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for QUR_BANK_ID.queryList
    at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:782) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:754) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.session.Configuration.addMappedStatement(Configuration.java:578) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:288) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:107) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:135) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:128) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118) ~[mybatis-3.2.7.jar:3.2.7]
    ... 27 common frames omitted
十月 26, 2018 2:42:47 下午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class cn.com.yitong.ares.core.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory4' defined in ServletContext resource [/WEB-INF/spring/spring-mybatis_bhbank.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps\InteLZ\WEB-INF\classes\META-INF\mybatis\oracle\bhbank\mapping\map55\QUR_BANK_ID.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for QUR_BANK_ID.queryList
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:684)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at cn.com.yitong.ares.core.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:21)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps\InteLZ\WEB-INF\classes\META-INF\mybatis\oracle\bhbank\mapping\map55\QUR_BANK_ID.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for QUR_BANK_ID.queryList
    at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:412)
    at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:295)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
    ... 22 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: 
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMa
pperBuilder.java:120)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.jav
a:92)
    at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessio
nFactoryBean.java:410)
    ... 25 more
Caused by: java.lang.IllegalArgumentException: Mapped Statement
s collection a
lready contains value for QUR_BANK_ID.queryList
    at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:
782)
    at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:
754)
    at org.apache.ibatis.session.Configuration.addMappedStatement(Configuration.
java:578)
    at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(Mappe
rBuilderAssistant.java:288)
    at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLS
tatementBuilder.java:107)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(
XMLMapperBuilder.java:135)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(
XMLMapperBuilder.java:128)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMa
pperBuilder.java:118)
    ... 27 more

十月 26, 2018 2:42:47 下午 org.apache.catalina.core.StandardConte
xt startIntern

这时,我们只要找到跑错的xml,看他们的ID是否不一样,修改就好,如果xml文件重复,删除重复的文件。

转载于:https://www.cnblogs.com/renwangxu/p/9856591.html

你可能感兴趣的:(Mapped Statements collection already contains value for ***.***的问题)