码迷,mamicode.com
首页 > 其他好文 > 详细

MyBatis错误之找不到实体类

时间:2020-09-17 16:04:31      阅读:55      评论:0      收藏:0      [点我收藏+]

标签:one   ibatis   more   gis   cti   may   图片   sre   deb   

错误:找不到实体类

解决办法:放错了包,在相应包的平行位置创建了相同的包所以找不到实体类

DEBUG [main] - Logging initialized using ‘class org.apache.ibatis.logging.slf4j.Slf4jImpl‘ adapter.
DEBUG [main] - PooledDataSource forcefully closed/removed all connections.
DEBUG [main] - PooledDataSource forcefully closed/removed all connections.
DEBUG [main] - PooledDataSource forcefully closed/removed all connections.
DEBUG [main] - PooledDataSource forcefully closed/removed all connections.
Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.baizhi.test.TestEmp.main(TestEmp.java:9)
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error building SqlSession.
### The error may exist in com/baizhi/dao/EmpDaoMapper.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: 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 ‘com.baizhi.entity.Emp‘.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.baizhi.entity.Emp
    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
    at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:54)
    at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:38)
    at com.baizhi.MyBatisUtil.MyBatisUtil.<clinit>(MyBatisUtil.java:18)
    ... 1 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: 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 ‘com.baizhi.entity.Emp‘.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.baizhi.entity.Emp
    at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:109)
    at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
    at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:52)
    ... 3 more
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 ‘com.baizhi.entity.Emp‘.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.baizhi.entity.Emp
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
    at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
    at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
    ... 5 more
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘com.baizhi.entity.Emp‘.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.baizhi.entity.Emp
    at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:103)
    at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:72)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:135)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:128)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
    ... 8 more
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘com.baizhi.entity.Emp‘.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.baizhi.entity.Emp
    at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:117)
    at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:130)
    at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:101)
    ... 12 more
Caused by: java.lang.ClassNotFoundException: Cannot find class: com.baizhi.entity.Emp
    at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:190)
    at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89)
    at org.apache.ibatis.io.Resources.classForName(Resources.java:256)
    at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:113)
    ... 14 more

技术图片

 

MyBatis错误之找不到实体类

标签:one   ibatis   more   gis   cti   may   图片   sre   deb   

原文地址:https://www.cnblogs.com/alexliuf/p/13620894.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!