mybatis报错:The alias 'xxx' is already mapped to the value '*.*.xxx'

简介: The alias 'xxx' is already mapped to the value '*.*.xxx'

mybatis报错:The alias 'xxx' is already mapped to the value '*.*.xxx'


  先贴上我所遇到的异常,这是我在IDEA上启动iBase4J时遇到的错误:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-11-19 13:43:20.925 [localhost-startStop-1] ERROR [SpringApplication:842] - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'coreTask': Unsatisfied dependency expressed through field 'sessionService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysSessionServiceImpl': Unsatisfied dependency expressed through field 'mapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sysSessionMapper' defined in file [D:\Workspace\IDEAProjects\iBase4J\iBase4J-SYS-Service\target\iBase4J-SYS-Service\WEB-INF\classes\org\ibase4j\mapper\SysSessionMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [top/ibase4j/core/config/MyBatisConfig.class]: Invocation of init method failed; nested exception is org.apache.ibatis.type.TypeException: The alias 'MultipleFailureException' is already mapped to the value 'org.junit.runners.model.MultipleFailureException'.
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
	......


   异常重点是:
   org.apache.ibatis.type.TypeException: The alias 'MultipleFailureException' is already mapped to the value 'org.junit.runners.model.MultipleFailureException'.
   经过分析,原来是因为配置文件中,mybatis指定别名时,指定的是一个路径mybatis.typeAliasesPackage=*.**.model*,而不是一个具体类或者固定路径的包,恰巧该项目依赖的jar包中,存在同名类或者包。把 *.**.model* 修改为org.ibase4j.model*再启动就不报错了。这种问题,可以在配置文件中搜索Aliases,先找到在哪里配置的别名。

目录
相关文章
|
2月前
|
SQL Java 数据库连接
mybatis报错 resultMapException
mybatis报错 resultMapException
21 0
mybatis报错 resultMapException
|
30天前
|
Java Apache vr&ar
springmvc报错 nested exception is org.mybatis.spring.MyBatisSystemException:
springmvc报错 nested exception is org.mybatis.spring.MyBatisSystemException:
15 0
|
30天前
|
Java Windows Perl
mybatis+spring报错PropertyAccessException 1: org.springframework.beans.MethodInvocationException
mybatis+spring报错PropertyAccessException 1: org.springframework.beans.MethodInvocationException
9 0
|
30天前
|
XML Java 数据库连接
mybatis报错:java.lang.IllegalArgumentException: Mapped Statements collection does not contain
mybatis报错:java.lang.IllegalArgumentException: Mapped Statements collection does not contain
11 0
|
6月前
|
Java 数据库连接 mybatis
flowable项目启动项目报错:Consider defining a bean of type ‘org.mybatis.spring.SqlSessionTemplate‘ in ……
flowable项目启动项目报错:Consider defining a bean of type ‘org.mybatis.spring.SqlSessionTemplate‘ in ……
128 0
|
3月前
|
SQL XML Java
mybatis元素类型为 "resultMap" 的内容必须匹配 "(constructor?,id *,result*,association报错解决
mybatis元素类型为 "resultMap" 的内容必须匹配 "(constructor?,id *,result*,association报错解决
49 0
|
5月前
|
Java 关系型数据库 MySQL
Mybatis数据库连接报错:对实体 “characterEncoding“ 的引用必须以 ‘;‘ 分隔符结尾
Mybatis数据库连接报错:对实体 “characterEncoding“ 的引用必须以 ‘;‘ 分隔符结尾
|
6月前
|
XML Java 数据库连接
Mybatis的报错问题:1 字节的 UTF-8 序列的字节 1 无效,​java.lang.IllegalStateException: Failed to load ApplicationCon
Mybatis的报错问题:1 字节的 UTF-8 序列的字节 1 无效,​java.lang.IllegalStateException: Failed to load ApplicationCon
66 0
|
8月前
|
Java
SpringBoot整合MyBatisPlus出错报错记录:Field userMapper in UserServiceImpl required a bean that could not be
SpringBoot整合MyBatisPlus出错报错记录:Field userMapper in UserServiceImpl required a bean that could not be
|
9月前
|
XML Java 数据库连接
使用Mybatis时mybatis-config.xml配置中报错“configuration“ 的内容必须匹配 (...)的解决方案
使用Mybatis时mybatis-config.xml配置中报错“configuration“ 的内容必须匹配 (...)的解决方案
65 0