Sherlock-4869 opened a new issue, #24880:
URL: https://github.com/apache/shardingsphere/issues/24880
version :
sharding jdbc 5.2.1
spring boot
mybatis-plus
excuse me , when I start the spring boot project ,it occur the problem:
"Properties `strategy` can not be null when uses class based sharding
strategy."
as you can see some of the stack
`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:980)
at
org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithm.getStrategy(ClassBasedShardingAlgorithm.java:66)
at
org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithm.init(ClassBasedShardingAlgorithm.java:59)
at
org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIRegistry.findRegisteredService(TypedSPIRegistry.java:66)
at
org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIRegistry.getRegisteredService(TypedSPIRegistry.java:113)
at
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmFactory.createAlgorithm(ShardingSphereAlgorithmFactory.java:40)
at
org.apache.shardingsphere.sharding.factory.ShardingAlgorithmFactory.newInstance(ShardingAlgorithmFactory.java:45)
at
org.apache.shardingsphere.sharding.rule.ShardingRule.lambda$new$0(ShardingRule.java:120)`
I have seem some solution is replace the algorithms "_" to "-"
but my yaml already none "_"
as you can see
`spring:
shardingsphere:
datasource:
names: ds0
ds0:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: ""
username:
password:
initial-size: 10
max-active: 100
min-idle: 10
max-wait: 60000
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 20
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
test-while-idle: true
test-on-borrow: false
test-on-return: false
stat-view-servlet:
enabled: true
url-pattern: /druid/*
#login-username: admin
#login-password: admin
filter:
stat:
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: false
wall:
config:
multi-statement-allow: true
rules:
sharding:
tables:
data_energy_15min:
actual-data-nodes:
ds0.data_energy_15min_$->{2020..2030}${(1..12).collect{t->t.toString().padLeft(2,'0')}}
table-strategy:
standard:
sharding-column: stat_date_time
sharding-algorithm-name: dateTime
sharding-algorithms:
dateTime:
type: CLASS_BASED
props:
strategy: STANDARD
algorithmClassName:
com.hgny.energy.module.data.sharding.StatTimeShardingAlgorithm
props:
sql-show: true
`
I can't find any problems, counld you tell me what is wrong ?
thank you very much!
--
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]