MyBatis错误之找不到实体类

技术文章 1年前 (2020) 完美者
278 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

版权声明:完美者 发表于 2020-09-17 16:04:31。
转载请注明:MyBatis错误之找不到实体类 | 完美导航

暂无评论

暂无评论...