zoukankan      html  css  js  c++  java
  • 配置mybatis错误总结

    ### The error may exist in SQL Mapper Configuration
    ### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException: Document root element "configuration", must match DOCTYPE root "mapper".
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
        at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:32)
        at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:15)
        at com.mybatis.test.UserTest.main(UserTest.java:20)

    错误来源,连接池的配置里面错了
    连接词对应的dtd文件是mybatis-3-config.dtd,如果你是直接复制了mybatis-3-mapper.dtd就会报错,改过来就行了

    Exception in thread "main" org.apache.ibatis.datasource.DataSourceException: Error setting driver on UnpooledDataSource. Cause: java.lang.NullPointerException
        at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.initializeDriver(UnpooledDataSource.java:179)
        at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:57)
        at org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:349)
        at org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:55)
        at org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSessionFromDataSource(DefaultSqlSessionFactory.java:72)
        at org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSession(DefaultSqlSessionFactory.java:32)
        at com.mybatis.test.UserTest.main(UserTest.java:24)
    错误来源:在连接池里面缺少驱动配置 <property name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/> 
         并且需要导入驱动包
    ### Error updating database.  Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'addtime' in 'class com.entity.UsersEntity'
    ### The error may involve com.entity.Users.insert-Inline
    ### The error occurred while setting parameters
    ### Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'addtime' in 'class com.entity.UsersEntity'

    错误原因:需要赋值的参数名称跟你的实体类名称需要对应
  • 相关阅读:
    我们为什么要使用Spring Cloud?简介
    Spring注解@Component、@Repository、@Service、@Controller区别
    Spring boot 各种入门及问题
    spring boot与spring mvc的区别是什么?
    Android http Request / Response ContentType
    Android Studio添加aar
    Android 自定义线程池的实战
    Android AsyncTask 深度理解、简单封装、任务队列分析、自定义线程池
    EditText 显示明文和密码
    Android log 管理工具
  • 原文地址:https://www.cnblogs.com/fxd980519/p/5407545.html
Copyright © 2011-2022 走看看