mybatis-Error building SqlSession

Posted 成为海贼王的男人

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis-Error building SqlSession相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章

PostgreSQL Q&A: Building an Enterprise-Grade PostgreSQL Setup Using Open Source Tools

matlab里sq啥意思

void create_sq(sqlist &sq,int n)在数据结构中的含义

mybatis执行过程及经典面试题

sqlist中的sq代表啥意思

sq2000中的row_number()