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'

    错误原因:需要赋值的参数名称跟你的实体类名称需要对应
  • 相关阅读:
    React初识整理(二)--生命周期的方法
    React初识整理(一)
    前后端分离浅析
    url地址数据参数转化JSON对象(js三种方法实现)
    js和JQuery中的获取宽、高、位置等方法整理
    游民轮播图效果实现
    焦点轮播图效果实现
    iOS开发debug集锦
    实现一个 RESTful API 服务器
    从iOS的图片圆角想到渲染
  • 原文地址:https://www.cnblogs.com/fxd980519/p/5407545.html
Copyright © 2011-2022 走看看