You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "YXxy1002 (via GitHub)" <gi...@apache.org> on 2024/12/11 11:40:08 UTC

[I] Properties `strategy` can not be null when uses class based sharding strategy. [shardingsphere]

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

   ## Question
   why can't i read props
   ![image](https://github.com/user-attachments/assets/421b3be2-0544-405d-adf2-cf74be5b82f8)
   
   
   ### Which version of ShardingSphere did you use?
   `
   <dependency>
       <groupId>org.apache.shardingsphere</groupId>
       <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
       <version>5.2.1</version>
   </dependency>
   `
   
   ### YAML
   `
     shardingsphere:
       rules:
         sharding:
           sharding-algorithms:
             uidshardingalgorithm:
               type: CLASS_BASED
               props:
                 strategy: standard
                 algorithmClassName: com.task.config.UidShardingAlgorithm
           tables:
             t_task_recommend:
               actual-data-nodes: dw.t_task_recommend
               table-strategy:
                 standard:
                   sharding-column: Duid
                   sharding-algorithm-name: uidshardingalgorithm
   `
   
   ### Actual behavior
   `Caused by: java.lang.NullPointerException: Properties `strategy` can not be null when uses class based sharding strategy.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:989) ~[guava-30.1.1-jre.jar:?]
   	at org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithm.getStrategy(ClassBasedShardingAlgorithm.java:66) ~[shardingsphere-sharding-core-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithm.init(ClassBasedShardingAlgorithm.java:59) ~[shardingsphere-sharding-core-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIRegistry.findRegisteredService(TypedSPIRegistry.java:66) ~[shardingsphere-infra-util-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIRegistry.getRegisteredService(TypedSPIRegistry.java:113) ~[shardingsphere-infra-util-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmFactory.createAlgorithm(ShardingSphereAlgorithmFactory.java:40) ~[shardingsphere-infra-common-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.sharding.factory.ShardingAlgorithmFactory.newInstance(ShardingAlgorithmFactory.java:45) ~[shardingsphere-sharding-api-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.sharding.rule.ShardingRule.lambda$new$0(ShardingRule.java:120) ~[shardingsphere-sharding-core-5.2.1.jar:5.2.1]
   	at java.util.LinkedHashMap.forEach(LinkedHashMap.java:721) ~[?:?]
   	at org.apache.shardingsphere.sharding.rule.ShardingRule.<init>(ShardingRule.java:120) ~[shardingsphere-sharding-core-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.sharding.rule.builder.ShardingRuleBuilder.build(ShardingRuleBuilder.java:41) ~[shardingsphere-sharding-core-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.sharding.rule.builder.ShardingRuleBuilder.build(ShardingRuleBuilder.java:35) ~[shardingsphere-sharding-core-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.infra.rule.builder.database.DatabaseRulesBuilder.build(DatabaseRulesBuilder.java:58) ~[shardingsphere-infra-common-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase.create(ShardingSphereDatabase.java:87) ~[shardingsphere-infra-common-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabasesFactory.createGenericDatabases(ShardingSphereDatabasesFactory.java:81) ~[shardingsphere-infra-common-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabasesFactory.create(ShardingSphereDatabasesFactory.java:69) ~[shardingsphere-infra-common-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:91) ~[shardingsphere-mode-core-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:69) ~[shardingsphere-mode-core-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.mode.manager.standalone.StandaloneContextManagerBuilder.build(StandaloneContextManagerBuilder.java:49) ~[shardingsphere-standalone-mode-core-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.createContextManager(ShardingSphereDataSource.java:76) ~[shardingsphere-jdbc-core-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.<init>(ShardingSphereDataSource.java:64) ~[shardingsphere-jdbc-core-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory.createDataSource(ShardingSphereDataSourceFactory.java:93) ~[shardingsphere-jdbc-core-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration.shardingSphereDataSource(ShardingSphereAutoConfiguration.java:91) ~[shardingsphere-jdbc-core-spring-boot-starter-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration$$SpringCGLIB$$0.CGLIB$shardingSphereDataSource$2(<generated>) ~[shardingsphere-jdbc-core-spring-boot-starter-5.2.1.jar:5.2.1]
   	at org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration$$SpringCGLIB$$2.invoke(<generated>) ~[shardingsphere-jdbc-core-spring-boot-starter-5.2.1.jar:5.2.1]
   	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) ~[spring-core-6.0.4.jar:6.0.4]
   	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-6.0.4.jar:6.0.4]
   	at org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration$$SpringCGLIB$$0.shardingSphereDataSource(<generated>) ~[shardingsphere-jdbc-core-spring-boot-starter-5.2.1.jar:5.2.1]
   	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
   	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]`
   


-- 
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


Re: [I] Properties `strategy` can not be null when uses class based sharding strategy. [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #34011:
URL: https://github.com/apache/shardingsphere/issues/34011#issuecomment-2536319120

   The markdown format in your issue is incorrect. To facilitate reading, could you please revise it?


-- 
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


Re: [I] Properties `strategy` can not be null when uses class based sharding strategy. [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #34011: Properties `strategy` can not be null when uses class based sharding strategy.
URL: https://github.com/apache/shardingsphere/issues/34011


-- 
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


Re: [I] Properties `strategy` can not be null when uses class based sharding strategy. [shardingsphere]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #34011:
URL: https://github.com/apache/shardingsphere/issues/34011#issuecomment-2557862104

   There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.


-- 
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


Re: [I] Properties `strategy` can not be null when uses class based sharding strategy. [shardingsphere]

Posted by "YXxy1002 (via GitHub)" <gi...@apache.org>.
YXxy1002 commented on issue #34011:
URL: https://github.com/apache/shardingsphere/issues/34011#issuecomment-2537600819

   > The markdown format in your issue is incorrect. To facilitate reading, could you please revise it?
   
   its ok now


-- 
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


Re: [I] Properties `strategy` can not be null when uses class based sharding strategy. [shardingsphere]

Posted by "YXxy1002 (via GitHub)" <gi...@apache.org>.
YXxy1002 commented on issue #34011:
URL: https://github.com/apache/shardingsphere/issues/34011#issuecomment-2540448072

   Could someone help?


-- 
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


Re: [I] Properties `strategy` can not be null when uses class based sharding strategy. [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #34011:
URL: https://github.com/apache/shardingsphere/issues/34011#issuecomment-2540760585

   Can you try 5.5.1?


-- 
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