You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/07/27 11:09:05 UTC

[GitHub] [shardingsphere] silversteak opened a new issue, #19607: ComboPooledDataSource not compatible with apache shardingsphere

silversteak opened a new issue, #19607:
URL: https://github.com/apache/shardingsphere/issues/19607

   ## ComboPooledDataSource not compatible with apache shardingsphere. 
   
   I am currently trying to implement shardingshpere in my current company's codebase. Previously created an example project using HikariDataSource and it worked fine. 
   
   Now in companies code base uses c3p0.ComboPooledDataSource as datasource. So when am trying to create shardingshphere datasource using this datasource its failing. 
   
   In HikariDatasource, the standardProps are coming correct.
   <img width="734" alt="image" src="https://user-images.githubusercontent.com/25997886/181229436-e6492019-0bdf-4f0b-8ac7-8c508e4e2024.png">
   
   But in c3p0.ComboPooledDataSource, the standardProps are giving just password only.
   <img width="734" alt="image" src="https://user-images.githubusercontent.com/25997886/181229691-dc137910-ac57-4144-811f-6d5fed3802ea.png">
   
   The main cause of the issue is that in c3p0.ComboPooledDataSource, the properties are stored in different format. `Like username as user and url as jdbcUrl.` 
   <img width="982" alt="image" src="https://user-images.githubusercontent.com/25997886/181230461-42eb9ecd-af15-4925-8059-5081a0417283.png">
   
   
   `Thats why am getting a nullpointer exception here since both the keys are username and url`
   <img width="982" alt="image" src="https://user-images.githubusercontent.com/25997886/181230180-b2b2f3b8-2be1-41ab-a011-13efe2a1f0a8.png">
   
   I was under the assumption that apache shardingsphere is compatible with all kinds of datasource. I am stuck here. 
   
   
   Please help me out if possible. 
   
   Datasource Config 
   
   ```
   dataSources:
     ds:
       dataSourceClassName: com.mchange.v2.c3p0.ComboPooledDataSource
       driverClassName: com.mysql.jdbc.Driver
       jdbcUrl: jdbc:mysql://localhost:3306/demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
       user: root
       username: root
       password: password
       max-active: 16
   ```
   
   pom.xml
   ```
   <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>shardingsphere-jdbc-core</artifactId>
               <version>5.1.2</version>
   </dependency>
   <dependency>
                   <groupId>com.mchange</groupId>
                   <artifactId>c3p0</artifactId>
                   <version>0.9.5.1</version>
   </dependency>
   
   ```
   
   
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] silversteak commented on issue #19607: ComboPooledDataSource not compatible with apache shardingsphere

Posted by GitBox <gi...@apache.org>.
silversteak commented on issue #19607:
URL: https://github.com/apache/shardingsphere/issues/19607#issuecomment-1207402942

   https://github.com/apache/shardingsphere/pull/19947
   
   @TeslaCN Please review the PR.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] silversteak commented on issue #19607: ComboPooledDataSource not compatible with apache shardingsphere

Posted by GitBox <gi...@apache.org>.
silversteak commented on issue #19607:
URL: https://github.com/apache/shardingsphere/issues/19607#issuecomment-1198945324

   Hi @TeslaCN Yes am interested in fixing it. I will provide it soon 


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on issue #19607: ComboPooledDataSource not compatible with apache shardingsphere

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #19607:
URL: https://github.com/apache/shardingsphere/issues/19607#issuecomment-1198898274

   Hi @silversteak 
   Are you interested in fixing this?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on issue #19607: ComboPooledDataSource not compatible with apache shardingsphere

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #19607:
URL: https://github.com/apache/shardingsphere/issues/19607#issuecomment-1198889062

   I've reproduced this issue.
   
   ```
   [INFO ] 2022-07-29 13:15:56,294 --main-- [com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource] Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> z8kfsxaqk30d5911hdcsh|47d9a273, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> null, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> z8kfsxaqk30d5911hdcsh|47d9a273, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
 &useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {password=******, user=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ] 
   [INFO ] 2022-07-29 13:15:56,319 --main-- [com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource] Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> z8kfsxaqk30d5911hdcsh|68dc098b, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> null, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> z8kfsxaqk30d5911hdcsh|68dc098b, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
 &useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {password=******, user=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ] 
   Exception in thread "main" java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "java.util.Map.get(Object)" is null
   	at org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResource.createDataSourceMetaDataMap(ShardingSphereResource.java:63)
   	at org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResource.<init>(ShardingSphereResource.java:52)
   	at org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase.createResource(ShardingSphereDatabase.java:115)
   	at org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase.create(ShardingSphereDatabase.java:109)
   	at org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase.create(ShardingSphereDatabase.java:91)
   	at org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabasesFactory.createGenericDatabases(ShardingSphereDatabasesFactory.java:80)
   	at org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabasesFactory.create(ShardingSphereDatabasesFactory.java:68)
   	at org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:66)
   	at org.apache.shardingsphere.mode.manager.standalone.StandaloneContextManagerBuilder.build(StandaloneContextManagerBuilder.java:51)
   	at org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.createContextManager(ShardingSphereDataSource.java:74)
   	at org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.<init>(ShardingSphereDataSource.java:64)
   	at org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory.createDataSource(ShardingSphereDataSourceFactory.java:93)
   	at org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:133)
   	at org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:62)
   	at org.apache.shardingsphere.example.sharding.raw.jdbc.factory.YamlDataSourceFactory.newInstance(YamlDataSourceFactory.java:33)
   	at org.apache.shardingsphere.example.sharding.raw.jdbc.ShardingRawYamlConfigurationExample.main(ShardingRawYamlConfigurationExample.java:41)
   ```


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on issue #19607: ComboPooledDataSource not compatible with apache shardingsphere

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #19607:
URL: https://github.com/apache/shardingsphere/issues/19607#issuecomment-1198880038

   Hi @silversteak 
   Thanks for your feedback. I'm going to check this.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on issue #19607: ComboPooledDataSource not compatible with apache shardingsphere

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #19607:
URL: https://github.com/apache/shardingsphere/issues/19607#issuecomment-1198898084

   This could be fixed by implementing `DataSourcePoolMetaData` for c3p0, just like what we did for HikariCP and DBCP.
   
   https://github.com/apache/shardingsphere/tree/master/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] terrymanu closed issue #19607: ComboPooledDataSource not compatible with apache shardingsphere

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #19607: ComboPooledDataSource not compatible with apache shardingsphere
URL: https://github.com/apache/shardingsphere/issues/19607


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org