• MyBatis错误之找不到实体类


    错误:找不到实体类

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

    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

    以粮为纲全面发展
  • 相关阅读:
    Python全栈开发:socket
    Python全栈开发:线程、进程和协程
    Python全栈开发:基本数据类型
    Python全栈开发:运算符
    使用pyplot和seaborn进行画图
    数据预处理之缺失值的处理
    数据预处理之标准化
    数据预处理之离散化
    集成学习中的 stacking 以及python实现
    使用sklearn进行交叉验证
  • 原文地址:https://www.cnblogs.com/alexliuf/p/13620894.html
Copyright © 2020-2023  润新知