org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for my.test.DbMapper.TestResult

Apache's JIRA Issue Tracker | Daniel Stanciu | 7 years ago
  1. 0

    I am getting an exception when I try to call SqlSessionFactoryBuilder.build. The exception is: Exception in thread "main" org.apache.ibatis.exceptions.IbatisException: ### Error building SqlSession. ### The error may exist in my/test/DbMapper.xml ### The error occurred while processing mapper_resultMap[TestResult] ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for my.test.DbMapper.TestResult at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8) at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:32) at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:23) at amdocs.pv.configurationtool.client.PvConfigurationPlugin.login(PvConfigurationPlugin.java:376) at amdocs.pv.configurationtool.client.PvConfigurationPlugin.main(PvConfigurationPlugin.java:353) Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for my.test.DbMapper.TestResult at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:71) at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:55) at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:29) ... 3 more Caused by: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for my.test.DbMapper.TestResult at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:59) at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:39) at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:71) at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:49) at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:43) at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:354) at org.apache.ibatis.builder.xml.XMLMapperBuilder.bindMapperForNamespace(XMLMapperBuilder.java:234) at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:40) at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:247) at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:69) ... 5 more Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for my.test.DbMapper.TestResult at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:395) at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:370) at org.apache.ibatis.session.Configuration.addResultMap(Configuration.java:294) at org.apache.ibatis.builder.MapperBuilderAssistant.addResultMap(MapperBuilderAssistant.java:128) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:148) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:118) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:113) at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:55) ... 14 more The configuration files I have are: config2.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//ibatis.apache.orgg//DTD Config 3.0//EN" "http://ibatis.apache.org/dtd/ibatis-3-config.dtd"> <configuration> <typeAliases> <typeAlias alias="Label" type="java.awt.Label" /> </typeAliases> <environments default="development"> <environment id="development"> <transactionManager type="JDBC"/> <dataSource type="POOLED"> <property name="driver" value="oracle.jdbc.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@${server}:${port}:${instance}"/> <property name="username" value="${username}"/> <property name="password" value="${password}"/> </dataSource> </environment> </environments> <mappers> <mapper resource="my/test/DBMapper.xml"/> </mappers> </configuration> DBMapper.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN" "http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd"> <mapper namespace="my.test.DbMapper"> <resultMap id="TestResult" type="Label"> <result property="text" column="test"/> </resultMap> <select id="selectTest" resultMap="TestResult"> select * from test </select> </mapper> I found out that the problem reproduces only when I have the following interface defined: package my.test; public interface DbMapper { public java.awt.Label selectTest(); } Somehow, it parses the xml again and it gives the exception.

    Apache's JIRA Issue Tracker | 7 years ago | Daniel Stanciu
    org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for my.test.DbMapper.TestResult
  2. 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
  3. 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
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 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
  6. 0

    mybatis PersistenceException Mapper error

    Stack Overflow | 3 years ago | konik polny
    org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 70; Document root element "mapper", must match DOCTYPE root "null".

  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

    Result Maps collection already contains value for my.test.DbMapper.TestResult

    at org.apache.ibatis.session.Configuration$StrictMap.put()
  2. MyBatis
    SqlSessionFactoryBuilder.build
    1. org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:395)
    2. org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:370)
    3. org.apache.ibatis.session.Configuration.addResultMap(Configuration.java:294)
    4. org.apache.ibatis.builder.MapperBuilderAssistant.addResultMap(MapperBuilderAssistant.java:128)
    5. org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:148)
    6. org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:118)
    7. org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:113)
    8. org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:55)
    9. org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:39)
    10. org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:71)
    11. org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:49)
    12. org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:43)
    13. org.apache.ibatis.session.Configuration.addMapper(Configuration.java:354)
    14. org.apache.ibatis.builder.xml.XMLMapperBuilder.bindMapperForNamespace(XMLMapperBuilder.java:234)
    15. org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:40)
    16. org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:247)
    17. org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:69)
    18. org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:55)
    19. org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:29)
    20. org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:23)
    20 frames
  3. amdocs.pv.configurationtool
    PvConfigurationPlugin.main
    1. amdocs.pv.configurationtool.client.PvConfigurationPlugin.login(PvConfigurationPlugin.java:376)
    2. amdocs.pv.configurationtool.client.PvConfigurationPlugin.main(PvConfigurationPlugin.java:353)
    2 frames