TencentChina opened a new issue, #18920:
URL: https://github.com/apache/shardingsphere/issues/18920
## Bug Report
### Which version of ShardingSphere did you use?
ShardingSphere version :
`org.apache.shardingsphere:shardingsphere-jdbc-core-spring-boot-starter:5.1.2`
atomikos version:
- `com.atomikos:atomikos-util:5.0.9`
- `com.atomikos:transactions:5.0.9`
- `com.atomikos:transactions-jta:5.0.9`
- `com.atomikos:transactions-jms:5.0.9`
- `com.atomikos:transactions-api:5.0.9`
- `com.atomikos:transactions-jdbc:5.0.9`
springboot version: `2.1.12.RELEASE`
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy
ShardingSphere-JDBC
### Expected behavior
System works well and shardingshpere can load read-write datasources.
configuration:
```properties
spring.shardingsphere.enabled = true
spring.shardingsphere.database.name=datasoure-rw
spring.shardingsphere.datasource.names=datasourewrite,datasoureread
spring.shardingsphere.props.sql.show=true
spring.shardingsphere.datasource.datasourewrite.type=com.atomikos.jdbc.AtomikosNonXADataSourceBean
spring.shardingsphere.datasource.datasourewrite.uniqueResourceName=datasoure_write
spring.shardingsphere.datasource.datasourewrite.driverClassName=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.datasourewrite.url=
spring.shardingsphere.datasource.datasourewrite.user=
spring.shardingsphere.datasource.datasourewrite.password=
spring.shardingsphere.datasource.datasourewrite.minPoolSize=10
spring.shardingsphere.datasource.datasourewrite.maxPoolSize=100
spring.shardingsphere.datasource.datasourewrite.maxIdleTime=60
spring.shardingsphere.datasource.datasourewrite.maxLifetime=3600
spring.shardingsphere.datasource.datasourewrite.borrowConnectionTimeout=6
spring.shardingsphere.datasource.datasourewrite.maintenanceInterval=60
spring.shardingsphere.datasource.datasourewrite.testQuery=SELECT 1
spring.shardingsphere.datasource.datasoureread.type=com.atomikos.jdbc.AtomikosNonXADataSourceBean
spring.shardingsphere.datasource.datasoureread.uniqueResourceName=datasoure_read
spring.shardingsphere.datasource.datasoureread.driverClassName=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.datasoureread.url=j
spring.shardingsphere.datasource.datasoureread.user=
spring.shardingsphere.datasource.datasoureread.password=
spring.shardingsphere.datasource.datasoureread.minPoolSize=10
spring.shardingsphere.datasource.datasoureread.maxPoolSize=100
spring.shardingsphere.datasource.datasoureread.maxIdleTime=60
spring.shardingsphere.datasource.datasoureread.maxLifetime=3600
spring.shardingsphere.datasource.datasoureread.borrowConnectionTimeout=6
spring.shardingsphere.datasource.datasoureread.maintenanceInterval=60
spring.shardingsphere.datasource.datasoureread.testQuery=SELECT 1
spring.shardingsphere.rules.readwrite-splitting.data-sources.datasource-rw.type=Static
spring.shardingsphere.rules.readwrite-splitting.data-sources.datasource-rw.props.write-data-source-name=datasourewrite
spring.shardingsphere.rules.readwrite-splitting.data-sources.datasource-rw.props.read-data-source-names=datasoureread
```
### Actual behavior
When start, cannot init datasoure
### Reason analyze
1. If let shardingshpere load datasource automatically, property
`driverClassName` cannot set to `AtomikosNonXADataSourceBean`, as
`driverClassName` is a skipped property at
`org.apache.shardingsphere.infra.datasource.pool.creator.DataSourceReflection#SKIPPED_PROPERTY_KEYS`.
The `driverClassName` is missing, so
`com.atomikos.jdbc.AtomikosNonXADataSourceBean.AtomikosNonXAConnectionFactory#init`
cannot init datasource.
2. If init datasouce manually, `AtomikosNonXADataSourceBean` uses property
`user` as database loginname, not the same as common property `username`,
shardingspere throws NPE here `standardProps.get("username").toString()` at
line
`org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereResource.java:63
`.
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
### Example codes for reproduce this issue (such as a github link).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]