码迷,mamicode.com
首页 > 数据库 > 详细

mybatis-Error building SqlSession

时间:2020-06-21 09:34:48      阅读:102      评论:0      收藏:0      [点我收藏+]

标签:main   ibatis   异常   sql   rap   exce   iba   不能   org   

MyBatis之Error building SqlSession报错

错误描述:Error building SqlSession.

构建sqlSession错误

错误信息:

Unknown DataSource property: user

Unknown DataSource property: Driver

Unknown DataSource property: url

Unknown DataSource property: password

技术图片

这是由于properties中name属性值必须是这四个,其他的不能识别,就会报unknown的错误,只要填写正确就好

完整异常信息

Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:

Error building SqlSession.

The error may exist in SQL Mapper Configuration

Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.datasource.DataSourceException: Unknown DataSource property: rootpassword

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64)
at test.HelloMybatis.main(HelloMybatis.java:20)

Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.datasource.DataSourceException: Unknown DataSource property: rootpassword
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:121)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:99)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:78)
... 2 more
Caused by: org.apache.ibatis.datasource.DataSourceException: Unknown DataSource property: rootpassword
at org.apache.ibatis.datasource.unpooled.UnpooledDataSourceFactory.setProperties(UnpooledDataSourceFactory.java:55)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.dataSourceElement(XMLConfigBuilder.java:326)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.environmentsElement(XMLConfigBuilder.java:280)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:116)
... 4 more

总结

这个错误是和properties的name值有关,这里是四个不能更改的值,填写正确就可以了

mybatis-Error building SqlSession

标签:main   ibatis   异常   sql   rap   exce   iba   不能   org   

原文地址:https://www.cnblogs.com/yl-995820/p/13171244.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!