2021-06-2923:25:42.015 [main] ERROR org.mybatis.spring.mapper.MapperFactoryBean - Error while adding the mapper 'interface com.zero.auth.mapper.UserMapper' to configuration. org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'com/zero/auth/mapper/UserMapper.xml'. Cause: java.lang.ClassCastException: classcom.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap$Ambiguity cannot be cast to classorg.apache.ibatis.mapping.ResultMap (com.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap$Ambiguity and org.apache.ibatis.mapping.ResultMap are in unnamed module of loader 'app') at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:123) at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:95) at com.baomidou.mybatisplus.core.MybatisMapperAnnotationBuilder.loadXmlResource(MybatisMapperAnnotationBuilder.java:172) at com.baomidou.mybatisplus.core.MybatisMapperAnnotationBuilder.parse(MybatisMapperAnnotationBuilder.java:93) at com.baomidou.mybatisplus.core.MybatisMapperRegistry.addMapper(MybatisMapperRegistry.java:83) at com.baomidou.mybatisplus.core.MybatisConfiguration.addMapper(MybatisConfiguration.java:119) at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:80)
1 2 3 4 5 6 7 8 9 10
Caused by: java.lang.ClassCastException: classcom.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap$Ambiguity cannot be cast to classorg.apache.ibatis.mapping.ResultMap (com.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap$Ambiguity and org.apache.ibatis.mapping.ResultMap are in unnamed module of loader 'app') at com.baomidou.mybatisplus.core.MybatisConfiguration.checkGloballyForDiscriminatedNestedResultMaps(MybatisConfiguration.java:318) at com.baomidou.mybatisplus.core.MybatisConfiguration.addResultMap(MybatisConfiguration.java:222) at org.apache.ibatis.builder.MapperBuilderAssistant.addResultMap(MapperBuilderAssistant.java:209) at org.apache.ibatis.builder.ResultMapResolver.resolve(ResultMapResolver.java:47) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:289) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:254) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:246) at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:119) ... 39 common frames omitted
报错信息分析
在报错信息中,报告了一个 java.lang.ClassCastException 异常,这是 Java 中的类型转换异常。 具体的信息为class com.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap$Ambiguity cannot be cast to class org.apache.ibatis.mapping.ResultMap。 一个 MybatisConfiguration$StrictMap$Ambiguity 类型的对象无法转换为 ResultMap 对象。
@Override @SuppressWarnings("unchecked") public V put(String key, V value) { if (containsKey(key)) { thrownewIllegalArgumentException(name + " already contains value for " + key + (conflictMessageProducer == null ? "" : conflictMessageProducer.apply(super.get(key), value))); } if (useGeneratedShortKey) { if (key.contains(".")) { finalStringshortKey= getShortName(key); if (super.get(shortKey) == null) { super.put(shortKey, value); } else { super.put(shortKey, (V) newAmbiguity(shortKey)); } } } returnsuper.put(key, value); }
@Override public V get(Object key) { Vvalue=super.get(key); if (value == null) { thrownewIllegalArgumentException(name + " does not contain value for " + key); } if (useGeneratedShortKey && value instanceof StrictMap.Ambiguity) { thrownewIllegalArgumentException(((StrictMap.Ambiguity) value).getSubject() + " is ambiguous in " + name + " (try using the full name including the namespace, or rename one of the entries)"); } return value; }