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,先找到在哪里配置的别名。

目录
相关文章
|
7月前
|
SQL XML Java
mybatis 调用修改SQL时 出现了一个问题 没有修改成功也没有报错
mybatis 调用修改SQL时 出现了一个问题 没有修改成功也没有报错
59 0
|
7月前
|
SQL
解决一个mybatisplus left join里有ur报错问题
解决一个mybatisplus left join里有ur报错问题
74 0
|
7月前
|
SQL 安全 BI
基于jeecg-boot的nbcio-boot因升级mybatis-plus到3.5.3.1和JSQLParser 到4.6而引起的在线报表配置报错处理
基于jeecg-boot的nbcio-boot因升级mybatis-plus到3.5.3.1和JSQLParser 到4.6而引起的在线报表配置报错处理
182 0
|
6月前
|
Java 数据库连接 mybatis
mybatis参数报错Parameter ‘docId‘ not found. Available parameters are [arg1, arg0, param1, param2]
mybatis参数报错Parameter ‘docId‘ not found. Available parameters are [arg1, arg0, param1, param2]
若依修改,集成mybatisplus报错,若依集成mybatisplus,总是找不到映射是怎么回事只要是用mp的方法就找报,改成mybatisPlus配置一定要改
若依修改,集成mybatisplus报错,若依集成mybatisplus,总是找不到映射是怎么回事只要是用mp的方法就找报,改成mybatisPlus配置一定要改
|
7月前
|
Java 数据库连接 数据库
mybatis-plus报错:Can not find table primary key in Class
mybatis-plus报错:Can not find table primary key in Class
1600 1
|
7月前
|
前端开发 Java 数据库连接
若依 mybatis报错nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘XXX‘ 错误
若依 mybatis报错nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘XXX‘ 错误
145 0
|
7月前
|
XML Java 数据库连接
调用mybatisplus的封装CURD方法出现报错
调用mybatisplus的封装CURD方法出现报错
39 0
|
7月前
|
Java Apache vr&ar
springmvc报错 nested exception is org.mybatis.spring.MyBatisSystemException:
springmvc报错 nested exception is org.mybatis.spring.MyBatisSystemException:
|
7月前
|
Java Windows Perl
mybatis+spring报错PropertyAccessException 1: org.springframework.beans.MethodInvocationException
mybatis+spring报错PropertyAccessException 1: org.springframework.beans.MethodInvocationException