错误代码:

org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### The error may exist in com/jkw100/mybatis/mapper/PatientMapper.xml
### The error occurred while processing mapper_resultMap[BaseResultMap]
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.jkw100.mybatis.mapper.PatientMapper.BaseResultMap
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:82)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:66)
at com.jkw100.mybatis.mapper.PatientMapperTest.setUp(PatientMapperTest.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.jkw100.mybatis.mapper.PatientMapper.BaseResultMap
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:115)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:95)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)
... 25 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.jkw100.mybatis.mapper.PatientMapper.BaseResultMap
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:167)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:118)
at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:72)
at org.apache.ibatis.binding.MapperRegistry.addMappers(MapperRegistry.java:97)
at org.apache.ibatis.binding.MapperRegistry.addMappers(MapperRegistry.java:105)
at org.apache.ibatis.session.Configuration.addMappers(Configuration.java:667)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:331)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:113)
... 27 more
Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.jkw100.mybatis.mapper.PatientMapper.BaseResultMap
at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:802)
at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:774)
at org.apache.ibatis.session.Configuration.addResultMap(Configuration.java:556)
at org.apache.ibatis.builder.MapperBuilderAssistant.addResultMap(MapperBuilderAssistant.java:217)
at org.apache.ibatis.builder.ResultMapResolver.resolve(ResultMapResolver.java:47)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:285)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:252)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:244)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:116)
... 36 more

Result Maps collection already contains value for com.jkw100.mybatis.mapper.PatientMapper.BaseResultMap 看到这句是因为mapper.xml文件中id为BaseResultMap这个名称重复 删除重复解决问题

在用mybatis逆向工程自动生成mapper.xml的时候 如果不小心多运行了一次 那么在mapper.xml文件中的代码会多出一份 这样就会造成相同的id有两个或多个了 而相同的文件是不会多生成的

Junit测试错误:### Error building SqlSession的更多相关文章

  1. MyException--org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ###

    org.apache.ibatis.exceptions.PersistenceException:  ### Error building SqlSession. ### The error may ...

  2. ### Error building SqlSession. ### The error may exist in SQL Mapper Configuration ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibat

    这是一个由粗心导致的错误,具体报错如下: org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSessio ...

  3. Error building SqlSession. ### The error may exist in dao/UserMapper.xml ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration(2 字节的 UTF-8 序列的字节 2 无效。)

    关于在学习Mybatis框架时运行报错 Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error building ...

  4. ### Error building SqlSession.

    org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession.### The error may e ...

  5. 集成JUnit测试错误java.lang.IllegalStateException: Failed to load ApplicationContext

    1 详细错误信息 java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.t ...

  6. java错误分析之junit测试错误(实验一)

    本文转自:https://www.cnblogs.com/anny0404/p/5275595.html 在原作者的基础上进行部分添加,也很感谢原作者这篇博文,帮我分析与解决问题! 原文: 下载了最新 ...

  7. spring3 + mybatis + maven:junit测试错误

    org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component c ...

  8. Mybatis-java.lang.RuntimeException: org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### The error may exist in sqlmap/User.xml ### Cause: org.apache.ibatis.builder.B

    mappers(映射器) 使用相对于类路径的资源 如:<mapper resource="sqlmap/User.xml" /> 使用完全限定路径 如:<mapp ...

  9. Unity出现 error building player exception android (invocation failed)

    今天在编译Android的时候出现这个错误 error building player exception android (invocation failed) 百度谷歌之后,看到xuanyuson ...

随机推荐

  1. C#设计模式:外观模式(Facade Pattern)

    一,什么是外观模式? 外观模式:为子系统中的一组接口提供一个一致的界面,定义一个高层接口,这个接口使得这一子系统更加容易使用. 二,我们看看代码的实现 using System; using Syst ...

  2. ajaxSubmit 实现图片上传 SSM maven

    文件上传依赖: <!-- 文件上传组件 --> <dependency> <groupId>commons-fileupload</groupId> & ...

  3. CentOS7搭建Kafka单机环境及基础操作

    前提 安装Kafka前需要先安装zookeeper集群,集体安装方法请参照我的另一篇文档. Kafka安装 下载 wget https://archive.apache.org/dist/kafka/ ...

  4. Windows 好用的护眼软件

    目录 1. 按 2. Windows10自带夜间模式 3. Iris Pro 3.1. 介绍 3.1.1. 保护用眼,改善睡眠 3.1.2. ×9 种不同的预设搭配 3.1.3. 计时器 3.1.4. ...

  5. CCF CSP/CCSP报名费优惠的方法以及常见疑问

    目录 1. 本文地址 2. 认证作用 2.1. 高校认可 2.2. 赛事认可 2.3. 企业认可 3. 报名费价格及获取优惠的方法 3.1. CCF CSP 3.2. CCF CCSP 4. 语言与I ...

  6. linux Sersync 上配置客户端

    1.安装 Rsync 并配置相关权限 在 SERSYNC 上配置 RSYNC 客户端相关权限认证: [root@SERSYNC /]# yum install rsync -y [root@SERSY ...

  7. Codeforces 1215E 状压DP

    题意:给你一个序列,你可以交换序列中的相邻的两个元素,问最少需要交换多少次可以让这个序列变成若干个极大的颜色相同的子段. 思路:由于题目中的颜色种类很少,考虑状压DP.设dp[mask]为把mask为 ...

  8. ARM平台常用性能测试方法

    测试磁盘读写速度: 通过安装hdparm,可以测试EMMC的读写速度: dolphin@localhost:~$ sudo apt-get install hdparm dolphin@localho ...

  9. gbase整合mybatis出现: Cause: java.sql.SQLException: Can't convert to: binary stream

    参考地址:http://mybatis-user.963551.n3.nabble.com/Map-SQL-Type-LVARCHAR-x-to-JDBC-Type-VARCHAR-globally- ...

  10. 每次当浏览到网页,点击tab标签又回到顶部去了!

    通常tab的标签使用a链接,而a链接的href值为#,这是一个锚点的属性,因此他会跳转到网页的顶端.如果你的tab包含一个id=tab,也可以设置为href="#tab"这样他就会 ...