2 dongblog DongBlog 于 2017.09.15 10:32 提问

Springmvc+mybatis整合出现点问题

刚刚开始学这个错误搞不懂是哪里出了问题,懂得朋友可以帮下吗

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemsMapper' defined in file [E:\Work2.metadata.plugins\org.eclipse.wst.server.core\tmp0\webapps\springmvc_mybatis\WEB-INF\classes\cn\itcast\ssm\mapper\ItemsMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for cn.itcast.ssm.mapper.ItemsMapper.BaseResultMap
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:589)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for cn.itcast.ssm.mapper.ItemsMapper.BaseResultMap
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:100)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
... 21 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for cn.itcast.ssm.mapper.ItemsMapper.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:164)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:118)
at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:71)
at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:651)
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:97)
... 24 more
Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for cn.itcast.ssm.mapper.ItemsMapper.BaseResultMap
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.addResultMap(Configuration.java:536)
at org.apache.ibatis.builder.MapperBuilderAssistant.addResultMap(MapperBuilderAssistant.java:207)
at org.apache.ibatis.builder.ResultMapResolver.resolve(ResultMapResolver.java:47)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:284)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:251)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:243)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:116)
... 30 more

九月 15, 2017 10:30:31 上午 org.apache.catalina.core.StandardContext startInternal
严重: One or more listeners failed to start. Full details will be found in the appropriate container log file
九月 15, 2017 10:30:31 上午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/springmvc_mybatis] startup failed due to previous errors
九月 15, 2017 10:30:31 上午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext

2个回答

fwinsky
fwinsky   2017.09.15 10:56

** Result Maps collection already contains value for cn.itcast.ssm.mapper.ItemsMapper.BaseResultMap**

重复定义了吧

u013168025
u013168025 回复DongBlog: 是怎么解决的?求帮助
大约 2 个月之前 回复
DongBlog
DongBlog 找到了,谢谢
10 个月之前 回复
huang931027
huang931027   Rxr 2017.09.15 11:43

Error creating bean with name 'itemsMapper' defined in file [E:\Work2.metadata.plugins\org.eclipse.wst.server.core\tmp0\webapps\springmvc_mybatis\WEB-INF\classes\cn\itcast\ssm\mapper\ItemsMapper.class]

DongBlog
DongBlog 找到了,谢谢
10 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
SpringMVC和mybatis整合时遇见的错误
在SpringMVC和mybatis整合时遇见个问题,我整合SSM框架时候,spring+mybatis用单元测试是可以运行的,增删改查都没问题。SpringMVC也是可以运行的,WEB-INF目录下的jsp也可以用Controller显示,不同页面之间的参数传递也是没问题。 但是mybatis和SpringMVC放一块就出问题了  严重: Exception sending cont
springmvc学习笔记(21)-springmvc整合mybatis遇到的问题及解决小结
本文主要记录springmvc整合mybatis整合过程中遇到的各种问题和解决方法 遇到的问题 在web.xml中标签报红 BeanCreationException mybatis绑定错误 请求参数乱码问题 请求参数类型转换问题 maven平台编码问题 json格式数据问题 还没弄懂但不影响运行的问题 加载spring容器报红 参数绑定配置问题 maven依赖分析问题
SpringMVC与Mybatis框架整合遇到的坑
最近在做springmvc与mybatis的项目,遇到一些比较坑的问题。花了许多时间却发现其实解决的办法很简单。这里主要是讲我自己在整合这两个框架的时候遇到的一些问题做一个整理。希望遇到和我同样问题的小伙伴可以不被坑。坑一:nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (
【SpringMVC整合MyBatis】整合思路与工程结构
springmvc和mybatis整合 1.需求 使用springmvc和mybatis完成商品列表查询。 2.整合思路 springmvc+mybaits的系统架构: 如图 第一步:整合dao层 mybatis和spring整合,通过spring管理mapper接口。 使用mapper的扫描器自动扫描mapper接口在spring中进行注册。 第二步:整合s
SSM核心包,SSM核心包
SSM(spring、SpringMVC和Mybatis)整合包 SSM(spring、SpringMVC和Mybatis)整合包 SSM(spring、SpringMVC和Mybatis)整合包
【Java】SpringMVC集成mybatis 连接池c3p0和druid分别实验
1.pom.xmlSpring框架包 mybatis包 AOP包 aspectj包 aopalliance包<!-- mysql start --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifact...
maven+(springmvc,mybatis,struts2,hibernate)两两整合
springmvc和mybatis整合,springmvc和hibernate整合,struts2和mybatis整合,struts2和hibernate整合
springmvc 和 mybatis 整合时因缺少jar包引起的错误
启动tomcat时会出现以下错误 Error creating bean with name ‘dataSource’ defined in ServletContext resource [/WEB-INF/classes/spring/applicationContext-dao.xml]: BeanPostProcessor before instantiation of bean fail
SpringMVC+Spring Security+mave+mybatis整合一
1.pom.xml http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> mo
IDEA中SpringMvc+Mybatis整合
工具IDE为idea15 JDK环境为1.8 maven版本为maven3目标完成基本的SpringMVC + Spring + MyBatis框架整合 数据库使用mysql 加入阿里巴巴的druid数据库连接池 使用gson作为json解析工具 实现日志输出 maven依赖的版本管理第一步: 使用idea的maven创建一个基本的web工程. 打开Idea在欢迎界面选择创建一个新的