spring+mybatis报错:Caused by: org.springframework.beans.factory.BeanCreationException: Error creating
2017-09-29 10:52
423 查看
1、报错信息
2、报错原因:
3、解决方案:
出现这个错误的原因是mybatis的映射文件(.xml)中存在相同命名空间的namespace,重命名这个namespace(SSubjectBlockItem)重启即可
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'calSqlSessionFactory' defined in class path resource [spring-cal-dao.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\workspace\eclipse-workspace\cal-task\cal-task-dao\target\classes\mybatis\SSubjectBlockItem.xml]'; nested exception is java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for SBlockItem.queryItemsByModuleId at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ... 28 more
2、报错原因:
java.lang.IllegalArgumentException: Mapped Statements collection already contains value for SBlockItem.queryItemsByModuleId
3、解决方案:
出现这个错误的原因是mybatis的映射文件(.xml)中存在相同命名空间的namespace,重命名这个namespace(SSubjectBlockItem)重启即可
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="SSubjectBlockItem"> <!--修改SSubjectBlockItem--> </mapper>
相关文章推荐
- Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with ......
- Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 't
- mybatis报错:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sq
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 这个错误完美解决
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServic
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SystControl'
- SSH整合时Tomcat启动报错:org.springframework.beans.factory.BeanCreationException: Error creating bean with n
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'selectcommoninfo' defined in ServletCont
- 无法创建action在spring中的bean的错:org.springframework.beans.factory.BeanCreationException: Error creating be
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao'问题
- FAQ(42):org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bill
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springfr
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eproductServ
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name
- org.springframework.beans.factory.BeanCreationException: Error creating bean 异常