mybatis报错:The alias 'xxx' is already mapped to the value 'com.demo.xxx'
来源:互联网 发布:js金沙.com 11 编辑:程序博客网 时间:2024/06/08 01:37
项目编译时,报错如下:
Caused by: org.apache.ibatis.type.TypeException: The alias 'xxx' is already mapped to the value 'com.demo.xxx'.at org.apache.ibatis.type.TypeAliasRegistry.registerAlias(TypeAliasRegistry.java:151)at org.apache.ibatis.type.TypeAliasRegistry.registerAlias(TypeAliasRegistry.java:144)at org.apache.ibatis.type.TypeAliasRegistry.registerAliases(TypeAliasRegistry.java:133)at org.apache.ibatis.type.TypeAliasRegistry.registerAliases(TypeAliasRegistry.java:122)at org.apache.ibatis.builder.xml.XMLConfigBuilder.typeAliasesElement(XMLConfigBuilder.java:118)at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:99)... 64 more
经过分析,原来是因为配置文件中,mybatis指定别名时,指定的是一个包路径,而不是一个具体的类。恰巧该项目依赖的jar包中,有2个不同jar包,存在同名类,并且所在包路径的顶层是相同的,故而出现此错误。
修改方法很简单,可以修改配置文件中的包路径,或者修改其中一个类名。
从mybatis源码的角度分析该错误的来源,请查看大牛文章:
http://my.oschina.net/zimingforever/blog/478137
0 0
- mybatis报错:The alias 'xxx' is already mapped to the value 'com.demo.xxx'
- mybatis绑定多个mapper,@ResultMap 报错: Mapped Statements collection already contains value for xxx
- Mapped Statements collection already contains value for com.xxx.xxx
- mybatis报错Type interface xxx.Dao is not known to the MapperRegistry
- The servlets named [xxx] and [com.web.xxx] are both mapped to the url-pattern
- Mybatis报错——Type interface com.mapper.EmployeeMapper is already known to the MapperRegistry.
- hibernate3报错 XXX is not mapped
- Spring配置文件标签报错:The prefix "XXX" for element "XXX:XXX" is not bound.
- Spring配置文件标签报错:The prefix "XXX" for element "XXX:XXX" is not bound. .
- The value for the useBean class attribute XXX is invalid
- The value for the useBean class attribute XXX is invalid”
- The value for the useBean class attribute XXX is invalid
- eclipse git 报错:the current branch is not configured for pull No value for key branch.xxx.merge found
- Access restriction: The method XXX from the type XXX is not accessible due to restriction XXX
- 启动Tomcat报错 Unable to load class[xxx xxx] to check against the @HandlesTypes annotation
- 报错There is no mapped Action name xxx解决
- Mapped Statements collection already contains value for xxxx.xxx.xxxx
- The Solution to "xxx is not in the sudoers file"
- OC对象与Core Foundation对象的转换
- Oracle学习笔记(12)------------集合、序列
- 浏览器标记已读链接
- 【bzoj3790】 神奇项链 mancher+树状数组优化dp
- Linux下面的路径问题
- mybatis报错:The alias 'xxx' is already mapped to the value 'com.demo.xxx'
- Windows XP SP1扫描结果分享
- GRE写作必备句型
- 什么是程序员?
- POJ2255-Tree Recovery
- JAVA环境变量JAVA_HOME、CLASSPATH、PATH设置详解
- android uri 简介
- generate alphanumeric serial number
- sgu163