Cause:java.lang.ClassNotFoundException:Cannot Find Class:baseresultmap at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( Abstractautowirecapablebeanfactory.java:1455) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( Abstractautowirecapablebeanfactory.java:519) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( Abstractautowirecapablebeanfactory.java:456) at org.springframework.beans.factory.support.abstractbeanfactory$1.GetObject (Abstractbeanfactory.java:294) at Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( Defaultsingletonbeanregistry.java:225) at Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (Abstractbeanfactory.java:291) at Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (Abstractbeanfactory.java:193) at Org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates ( Defaultlistablebeanfactory.java:871) at Org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency ( Defaultlistablebeanfactory.java:813) at Org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency ( Defaultlistablebeanfactory.java:730) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType ( Abstractautowirecapablebeanfactory.java:1184)... theMore caused By:org.apache.ibatis.builder.BuilderException:Error parsing Mapper XML. Cause:org.apache.ibatis.builder.BuilderException:Error resolving class. Cause:org.apache.ibatis.type.TypeException:Could not resolve type alias' Baseresultmap '. Cause:java.lang.ClassNotFoundException:Cannot Find Class:baseresultmap at Org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement (Xmlmapperbuilder.java:117) at Org.apache.ibatis.builder.xml.XMLMapperBuilder.parse (Xmlmapperbuilder.java: the) at Org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory (Sqlsessionfactorybean.java:464)... -morecaused By:org.apache.ibatis.builder.BuilderException:Error resolving class. Cause:org.apache.ibatis.type.TypeException:Could not resolve type alias' Baseresultmap '. Cause:java.lang.ClassNotFoundException:Cannot Find Class:baseresultmap at Org.apache.ibatis.builder.BaseBuilder.resolveClass (Basebuilder.java: -) at Org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode (Xmlstatementbuilder.java: the) at Org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext (Xmlmapperbuilder.java: the) at Org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext (Xmlmapperbuilder.java: the) at Org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement (Xmlmapperbuilder.java: the)... themorecaused by:org.apache.ibatis.type.TypeException:Could not resolve type alias' Baseresultmap '. Cause:java.lang.ClassNotFoundException:Cannot Find Class:baseresultmap at Org.apache.ibatis.type.TypeAliasRegistry . Resolvealias (Typealiasregistry.java: the) at Org.apache.ibatis.builder.BaseBuilder.resolveAlias (Basebuilder.java:127) at Org.apache.ibatis.builder.BaseBuilder.resolveClass (Basebuilder.java:98)... themorecaused By:java.lang.ClassNotFoundException:Cannot find Class:baseresultmap at Org.apache.ibatis.io.ClassLoaderW Rapper.classforname (Classloaderwrapper.java:188) at Org.apache.ibatis.io.ClassLoaderWrapper.classForName (Classloaderwrapper.java: the) at Org.apache.ibatis.io.Resources.classForName (Resources.java:254) at Org.apache.ibatis.type.TypeAliasRegistry.resolveAlias (Typealiasregistry.java: the)... 98More
The general meaning is that the result type corresponding to the return value cannot be found:
My error code is as follows:
<select id="getPageCount" resultMap="java.lang.Integer"> select count(*) from policy_change_record </select>
As you can see, the value I return is just an integer, not a resultmap,resultmap suitable for mybatis resultmap relative:
<resultmapID="Baseresultmap"Type="Dbquery.core.bean.OnsPolicayChangeRecord"> <IDcolumn="id" Property="id"Jdbctype="BIGINT"/> <resultcolumn="policy_id" Property="PolicyId"Jdbctype="BIGINT"/> <resultcolumn="Policy_type" Property="Policytype"Jdbctype="VARCHAR"/> <resultcolumn="Provider_name" Property="ProviderName"Jdbctype="VARCHAR"/> <resultcolumn="Status" Property="Status"Jdbctype="INTEGER"/> <resultcolumn="Failure_times" Property="Failuretimes"Jdbctype="INTEGER"/> <resultcolumn="Created_time" Property="Createdtime"Jdbctype="VARCHAR"/> <resultcolumn="Updated_time" Property="Updatedtime"Jdbctype="VARCHAR"/> <resultcolumn="Operate_type" Property="Operatetype"Jdbctype="VARCHAR"/> <resultcolumn="Policy_content" Property="Policycontent"Jdbctype="VARCHAR"/> <resultcolumn="Operate_time" Property="Operatetime"Jdbctype="VARCHAR"/> </resultMap>
So if the value returned is a basic data type using resulttype if yes and Resultmap
Matches, such as collections, maps, and so on, use Resultmap, for example:
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> select <include refid="Base_Column_List"/> from policy_change_record where#{id,jdbcType=BIGINT} </select>
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Mybtais Error: Org.apache.ibatis.builder.BuilderException:Error resolving class. CAUSE:ORG.A