org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for mapper.PersonMapper.get

Apache's JIRA Issue Tracker | Christian Poitras | 7 years ago
  1. 0

    Mapper interfaces cannot have the same name as the XML mapped to them. For example, an XML file mapper/PersonMapper.xml cannot be linked to a class named mapper.PersonMapper. Doing so leads to an exception : org.apache.ibatis.exceptions.IbatisException: ### Error building SqlSession. ### The error may exist in mapper/PersonMapper.xml ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for mapper.PersonMapper.get at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8) at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:31) at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:14) at test.MapperNameTest.initDatabase(MapperNameTest.java:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99) at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75) at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45) at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66) at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35) at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for mapper.PersonMapper.get at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:62) at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:47) at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:28) ... 22 more Caused by: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for mapper.PersonMapper.get at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:50) at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:31) at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:50) at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:29) at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:42) at org.apache.ibatis.mapping.Configuration.addMapper(Configuration.java:309) at org.apache.ibatis.builder.xml.XMLMapperBuilder.bindMapperForNamespace(XMLMapperBuilder.java:227) at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:32) at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:221) at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:60) ... 24 more Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for mapper.PersonMapper.get at org.apache.ibatis.mapping.Configuration$StrictMap.put(Configuration.java:349) at org.apache.ibatis.mapping.Configuration.addMappedStatement(Configuration.java:289) at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:213) at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:59) at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:185) at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:48) ... 33 more

    Apache's JIRA Issue Tracker | 7 years ago | Christian Poitras
    org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for mapper.PersonMapper.get
  2. 0

    MyBtis注解方式注册异常 - 数据库 - 木鱼驿站[ITfish]

    itfish.net | 1 year ago
    org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 26; columnNumber: 54; 必须声明元素类型 "package"。
  3. 0

    how to map char(1) to java.lang.Character

    Google Groups | 2 years ago | Gregory Kotsaftis
    org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalStateException: No typehandler found for property null
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    MyBatis 3.0.5 and mappers loading problem

    Stack Overflow | 5 years ago | raid3n
    org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource src/main/java/com/izs/mybatis/FormMapper.xml
  6. 0

    Error deploying a mybatis-truts application

    Stack Overflow | 4 years ago | yoprogramo
    org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: java.io.IOException: Stream closed

  1. asdasd 24 times, last 2 months ago
6 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalArgumentException

    Mapped Statements collection already contains value for mapper.PersonMapper.get

    at org.apache.ibatis.mapping.Configuration$StrictMap.put()
  2. MyBatis
    SqlSessionFactoryBuilder.build
    1. org.apache.ibatis.mapping.Configuration$StrictMap.put(Configuration.java:349)
    2. org.apache.ibatis.mapping.Configuration.addMappedStatement(Configuration.java:289)
    3. org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:213)
    4. org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:59)
    5. org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:185)
    6. org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:48)
    7. org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:31)
    8. org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:50)
    9. org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:29)
    10. org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:42)
    11. org.apache.ibatis.mapping.Configuration.addMapper(Configuration.java:309)
    12. org.apache.ibatis.builder.xml.XMLMapperBuilder.bindMapperForNamespace(XMLMapperBuilder.java:227)
    13. org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:32)
    14. org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:221)
    15. org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:60)
    16. org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:47)
    17. org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:28)
    18. org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:14)
    18 frames
  3. test
    MapperNameTest.initDatabase
    1. test.MapperNameTest.initDatabase(MapperNameTest.java:16)
    1 frame
  4. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:585)
    4 frames
  5. JUnit
    TestClassRunner.run
    1. org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
    2. org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
    3. org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
    4. org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
    5. org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
    6. org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
    7. org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
    8. org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
    9. org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
    10. org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
    10 frames
  6. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
    1 frame
  7. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    5 frames