配置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) 错误来源,连接池的配置里面错了

配置mybatis错误总结

连接词对应的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' 错误原因:需要赋值的参数名称跟你的实体类名称需要对应
上一篇:谈论高并发(三十)解析java.util.concurrent各种组件(十二) 认识CyclicBarrier栅栏


下一篇:【转载】Java Web学习(七)——HttpServletResponse对象(一)