Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias
2018-01-06 14:48
519 查看
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'blogServiceImpl': Unsatisfied dependency expressed through field 'blogDAO'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'blogDAO' defined in file [E:\1715\ssm-blog-admin\target\ssm-blog-admin\WEB-INF\classes\com\ssm\blog\dao\BlogDAO.class]:
Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-config.xml]: Invocation
of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\1715\ssm-blog-admin\target\ssm-blog-admin\WEB-INF\classes\com\ssm\blog\dao\mapper\BlogMappper.xml]'; nested exception is 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 'blogMap'. Cause:
java.lang.ClassNotFoundException: Cannot find class: blogMap
2018-01-06 11:38:20,931 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6dbb8301: defining beans [org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,dataSource,blogServiceImpl,categoryServiceImpl,keywordsServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,sqlSessionFactory,org.mybatis.spring.mapper.MapperScannerConfigurer#0,transactionManager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,serviceMethod,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,blogDAO,categoryDAO,keywordsDAO];
root of factory hierarchy
2018-01-06 11:38:20,931 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'blogServiceImpl': Unsatisfied dependency expressed through field 'blogDAO'; nested exception
is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'blogDAO' defined in file [E:\1715\ssm-blog-admin\target\ssm-blog-admin\WEB-INF\classes\com\ssm\blog\dao\BlogDAO.class]: Unsatisfied dependency expressed through
bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-config.xml]: Invocation of init method failed; nested exception
is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\1715\ssm-blog-admin\target\ssm-blog-admin\WEB-INF\classes\com\ssm\blog\dao\mapper\BlogMappper.xml]'; nested exception is 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 'blogMap'. Cause: java.lang.ClassNotFoundException: Cannot find class: blogMap
ssm整合,tomcat启动的时候报错。出现 Could not resolve type alias 'blogMap'异常。出现这个异常的原因有可能有两个
1. 没有配置实体类的别名Alias,如果在mybatis的mapper中映射实体类不写包名,需要配置别名
[html] view
plain copy
<!--spring管理session工厂-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mapperLocations" value="classpath:com/ssm/blog/dao/mapper/*.xml"/>
<!--配置别名所在的包-->
<property name="typeAliasesPackage" value="com.ssm.blog.pojo"/>
</bean>
2. resultMap和resultType写混了。通常这种情况会出现在select语句中。<select>标签的resultMap应该是mapper中<resultMap>的id,而resultType是一个具体的类型,也就是实体类的类名或者java基本数据类型int、long、string等。
Error creating bean with name 'blogServiceImpl': Unsatisfied dependency expressed through field 'blogDAO'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'blogDAO' defined in file [E:\1715\ssm-blog-admin\target\ssm-blog-admin\WEB-INF\classes\com\ssm\blog\dao\BlogDAO.class]:
Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-config.xml]: Invocation
of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\1715\ssm-blog-admin\target\ssm-blog-admin\WEB-INF\classes\com\ssm\blog\dao\mapper\BlogMappper.xml]'; nested exception is 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 'blogMap'. Cause:
java.lang.ClassNotFoundException: Cannot find class: blogMap
2018-01-06 11:38:20,931 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6dbb8301: defining beans [org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,dataSource,blogServiceImpl,categoryServiceImpl,keywordsServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,sqlSessionFactory,org.mybatis.spring.mapper.MapperScannerConfigurer#0,transactionManager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,serviceMethod,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,blogDAO,categoryDAO,keywordsDAO];
root of factory hierarchy
2018-01-06 11:38:20,931 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'blogServiceImpl': Unsatisfied dependency expressed through field 'blogDAO'; nested exception
is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'blogDAO' defined in file [E:\1715\ssm-blog-admin\target\ssm-blog-admin\WEB-INF\classes\com\ssm\blog\dao\BlogDAO.class]: Unsatisfied dependency expressed through
bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-config.xml]: Invocation of init method failed; nested exception
is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\1715\ssm-blog-admin\target\ssm-blog-admin\WEB-INF\classes\com\ssm\blog\dao\mapper\BlogMappper.xml]'; nested exception is 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 'blogMap'. Cause: java.lang.ClassNotFoundException: Cannot find class: blogMap
ssm整合,tomcat启动的时候报错。出现 Could not resolve type alias 'blogMap'异常。出现这个异常的原因有可能有两个
1. 没有配置实体类的别名Alias,如果在mybatis的mapper中映射实体类不写包名,需要配置别名
[html] view
plain copy
<!--spring管理session工厂-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mapperLocations" value="classpath:com/ssm/blog/dao/mapper/*.xml"/>
<!--配置别名所在的包-->
<property name="typeAliasesPackage" value="com.ssm.blog.pojo"/>
</bean>
2. resultMap和resultType写混了。通常这种情况会出现在select语句中。<select>标签的resultMap应该是mapper中<resultMap>的id,而resultType是一个具体的类型,也就是实体类的类名或者java基本数据类型int、long、string等。
相关文章推荐
- Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Types'
- mybatis之Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Address...错误原因分析
- Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias
- Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'ScoreWithCountAndTime'.
- Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias
- org.apache.ibatis.type.TypeException: Could not resolve type alias 'xxxx'异常
- Mybatis使用之 Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias‘User’
- Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'BaseResultMap‘
- Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'BaseResultMap'
- Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'BaseResultMap'
- org.apache.ibatis.type.TypeException: Could not resolve type alias
- org.apache.ibatis.type.TypeException: Could not resolve type alias 'id'.
- Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'BaseResultMap'
- Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias
- Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Student'
- Could not resolve type alias 'categoryMap'. Cause: java.lang.ClassNotFoundException: Cannot find cl
- MyBatis3.4.0以上的分页插件错误:Could not find method on interface org.apache.ibatis.executor.statement.StatementHandler named prepare. Cause: java.lang.NoSuchMethodException: org.apache.ibatis.executor.stateme
- org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map cn.itcast.ssm.po.
- FAQ(38):nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find res
- Exception: org.apache.ibatis.builder.xml.IncompleteStatementException: Could not find result map....