Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'userResultMap'. Cause: java.lang.ClassNotFoundException: Cannot find class: userResultMap
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:265)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:252)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:244)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:116)
... 104 more
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'userResultMap'. Cause: java.lang.ClassNotFoundException: Cannot find class: userResultMap
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120)
at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149)
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116)
... 108 more
最近在做SSM整合的时候,遇到这样一个ClassNotFoundException的bug,意思是无法找到返回值对应的result类型,最后发现是我把type和id写反了。
另外,如果返回的值是一个基本的数据类型使用的是resultType 如果是和resultMap
匹配的,比如说是集合,map等则使用resultMap。面向百度debug的时候看到了这种情况也会报类似的错。