We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
你好:
使用springboot+mybatis+sjdbc时发现了一个问题,供大家参考,如该问题已知,请忽略
版本信息 sharding-jdbc.version:2.0.0.M1 mybatis-spring-boot-starter:1.3.1 druid: 1.0.13 部分源码: -->io.shardingjdbc.spring.boot.SpringBootConfiguration#setDataSourceMap -->DataSource dataSource = DataSourceUtil.getDataSource(dataSourceProps.get("type").toString(), dataSourceProps);
--> io.shardingjdbc.core.util.DataSourceUtil#callSetterMethod --> Method method = dataSource.getClass().getDeclaredMethod(methodName, new Class[]{each});
原因排查: druid1.0.13版本 com.alibaba.druid.pool.DruidDataSource 自身不包含url、driveClass、password、username等属性,而是在其继承的抽象类DruidAbstractDataSource中。 而shardingjdbc中DataSourceUtil使用的是getDeclaredMethod方式,导致连接参数set不进去,datasource无法正常完成初始化,导致后续代码空指针。
最后解决方式: 改用dbcp连接池可正常使用
The text was updated successfully, but these errors were encountered:
duplicate with #404
Sorry, something went wrong.
No branches or pull requests
你好:
版本信息
sharding-jdbc.version:2.0.0.M1
mybatis-spring-boot-starter:1.3.1
druid: 1.0.13
部分源码:
-->io.shardingjdbc.spring.boot.SpringBootConfiguration#setDataSourceMap
-->DataSource dataSource = DataSourceUtil.getDataSource(dataSourceProps.get("type").toString(), dataSourceProps);
--> io.shardingjdbc.core.util.DataSourceUtil#callSetterMethod
--> Method method = dataSource.getClass().getDeclaredMethod(methodName, new Class[]{each});
原因排查:
druid1.0.13版本 com.alibaba.druid.pool.DruidDataSource 自身不包含url、driveClass、password、username等属性,而是在其继承的抽象类DruidAbstractDataSource中。
而shardingjdbc中DataSourceUtil使用的是getDeclaredMethod方式,导致连接参数set不进去,datasource无法正常完成初始化,导致后续代码空指针。
最后解决方式:
改用dbcp连接池可正常使用
The text was updated successfully, but these errors were encountered: