zoukankan      html  css  js  c++  java
  • Result Maps collection already contains value for ***

    今天在整合ssm框架是出现了错误  

    Error creating bean with name 'userServiceImpl': 
    Unsatisfied dependency expressed through field 'userMapper';
     nested exception is org.springframework.beans.factory.
     UnsatisfiedDependencyException: 
     Error creating bean with name 'userMapper' 
     defined in URL [jar:file:/D:/softwaredel/workspace/.metadata/
     .plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/
     manager-web/WEB-INF/lib/manager-dao-0.0.1-SNAPSHOT.jar!/
     com/atguigu/scw/manager/dao/UserMapper.class]: 
     Unsatisfied dependency expressed through bean 
     property 'sqlSessionFactory'; nested exception 
     is org.springframework.beans.factory.BeanCreationException: 
     Error creating bean with name 'sqlSessionFactoryBean' 
     defined in file [D:softwaredelworkspace.metadata.
     pluginsorg.eclipse.wst.server.core	mp0wtpwebapps
     manager-webWEB-INFclassesspring-mybatis.xml]: 
     Invocation of init method failed; nested exception 
     is org.springframework.core.NestedIOException: 
     Failed to parse mapping resource: 'class path resource [mybatis/mapper/UserMapper.xml]'; 
     nested exception is org.apache.ibatis.builder.BuilderException: 
     Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException:
     Result Maps collection already contains value for com.atguigu.scw.manager.dao.UserMapper.BaseResultMap
    

      其中的关键错误信息就是:Result Maps collection already contains value for ***

    在百度上查阅资料发现,是mybatis在逆向创建工程时,会自动生成sql配置映射文件,报这个错误是因为在生成是重复生成了,你没运行一次,就会在映射的mapper.xml中重新生成字段值,所以在后边的运行web工程时就会报错,解决办法就是将mapper.xml中的多余字段删除,或者是将mapper.xml配置文件删除,然后在重新生成,在重新生成的过程中pojo是不会重复生成的。

  • 相关阅读:
    线程内唯一对象HttpContext
    asp.net MVC 路由机制
    asp.net MVC 路由机制 Route
    asp.net MVC 路由系统
    asp.net中的路由系统
    Nodejs 高并发长链接TCP链接的服务器设计问题
    关于SharePoint 2010中不能使用AjaxControlToolkit的解决办法
    百度编辑器批量上传图片自动排版
    phpcms后台部分修改
    PHP导入excel发送网易云信短信
  • 原文地址:https://www.cnblogs.com/ljysy/p/12157771.html
Copyright © 2011-2022 走看看