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 2021/06/03 06:13:16 UTC
[GitHub] [shardingsphere] zjcnb opened a new issue #10633: Default not configured sharding.key-generators. Project startup error reported
zjcnb opened a new issue #10633:
URL: https://github.com/apache/shardingsphere/issues/10633
### Which version of ShardingSphere did you use?
5.0.0.alpha
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
### Expected behavior
SpringBoot 2.4.6, It starts up properly
>
spring:
shardingsphere:
# 展示修改以后的sql语句
props:
sql-show: true
datasource:
common:
driver-class-name: com.mysql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
names: ds0
ds0:
username: root
password: 123456
url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
rules:
sharding:
sharding-algorithms:
table-inline:
type: INLINE
props:
algorithm-expression: t_user$->{sharding_key % 4}
tables:
t_user:
actual-data-nodes: ds0.t_user$->{0..3}
table-strategy:
standard:
sharding-column: sharding_key
sharding-algorithm-name: table-inline
### Actual behavior
> java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_211]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_211]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_211]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_211]
at org.apache.shardingsphere.spring.boot.util.PropertyUtil.v2(PropertyUtil.java:111) ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-alpha.jar:5.0.0-alpha]
at org.apache.shardingsphere.spring.boot.util.PropertyUtil.handle(PropertyUtil.java:75) ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-alpha.jar:5.0.0-alpha]
at org.apache.shardingsphere.spring.boot.registry.AbstractAlgorithmProvidedBeanRegistry.registerBean(AbstractAlgorithmProvidedBeanRegistry.java:50) ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-alpha.jar:5.0.0-alpha]
at org.apache.shardingsphere.sharding.spring.boot.algorithm.KeyGenerateAlgorithmProvidedBeanRegistry.postProcessBeanDefinitionRegistry(KeyGenerateAlgorithmProvidedBeanRegistry.java:38) ~[shardingsphere-sharding-spring-boot-starter-5.0.0-alpha.jar:5.0.0-alpha]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311) ~[spring-context-5.3.7.jar:5.3.7]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:142) ~[spring-context-5.3.7.jar:5.3.7]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746) ~[spring-context-5.3.7.jar:5.3.7]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) ~[spring-context-5.3.7.jar:5.3.7]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.6.jar:2.4.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771) [spring-boot-2.4.6.jar:2.4.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763) [spring-boot-2.4.6.jar:2.4.6]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438) [spring-boot-2.4.6.jar:2.4.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) [spring-boot-2.4.6.jar:2.4.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) [spring-boot-2.4.6.jar:2.4.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318) [spring-boot-2.4.6.jar:2.4.6]
at com.example.demo.DemoApplication.main(DemoApplication.java:14) [classes/:na]
Caused by: java.util.NoSuchElementException: No value bound
at org.springframework.boot.context.properties.bind.BindResult.get(BindResult.java:55) ~[spring-boot-2.4.6.jar:2.4.6]
... 20 common frames omitted
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at org.springframework.util.ReflectionUtils.rethrowRuntimeException(ReflectionUtils.java:147)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:834)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:349)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318)
at com.example.demo.DemoApplication.main(DemoApplication.java:14)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.shardingsphere.spring.boot.util.PropertyUtil.v2(PropertyUtil.java:111)
at org.apache.shardingsphere.spring.boot.util.PropertyUtil.handle(PropertyUtil.java:75)
at org.apache.shardingsphere.spring.boot.registry.AbstractAlgorithmProvidedBeanRegistry.registerBean(AbstractAlgorithmProvidedBeanRegistry.java:50)
at org.apache.shardingsphere.sharding.spring.boot.algorithm.KeyGenerateAlgorithmProvidedBeanRegistry.postProcessBeanDefinitionRegistry(KeyGenerateAlgorithmProvidedBeanRegistry.java:38)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:142)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:339)
... 3 more
Caused by: java.util.NoSuchElementException: No value bound
at org.springframework.boot.context.properties.bind.BindResult.get(BindResult.java:55)
... 20 more
### Reason analyze (If you can)
sharding.key-generators not configured, But it still initializes KeyGenerateAlgorithmProvidedBeanRegistry when project start
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] zjcnb closed issue #10633: Default not configured sharding.key-generators. Project startup error reported
Posted by GitBox <gi...@apache.org>.
zjcnb closed issue #10633:
URL: https://github.com/apache/shardingsphere/issues/10633
--
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] SkySun90 commented on issue #10633: Default not configured sharding.key-generators. Project startup error reported
Posted by GitBox <gi...@apache.org>.
SkySun90 commented on issue #10633:
URL: https://github.com/apache/shardingsphere/issues/10633#issuecomment-872802929
mark. 遇到同样问题。
--
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] SkySun90 edited a comment on issue #10633: Default not configured sharding.key-generators. Project startup error reported
Posted by GitBox <gi...@apache.org>.
SkySun90 edited a comment on issue #10633:
URL: https://github.com/apache/shardingsphere/issues/10633#issuecomment-872802929
mark. 遇到同样问题。配置如下
#shardingsphere配置
spring.shardingsphere.datasource.names=db0
spring.shardingsphere.datasource.common.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.db0.url=jdbc:mysql://XX:XX/XXX?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
spring.shardingsphere.datasource.db0.username=XXX
spring.shardingsphere.datasource.db0.password=XXX
#sharding分表配置
spring.shardingsphere.rules.sharding.tables.tb_demo.actual-data-nodes=db0.tb_demo
spring.shardingsphere.rules.sharding.tables.tb_demo.database-strategy.standard.sharding-column=push_date
spring.shardingsphere.rules.sharding.tables.tb_demo.database-strategy.standard.sharding-algorithm-name=loc-sharding
#分片算法配置
spring.shardingsphere.rules.sharding.sharding-algorithms.loc-sharding.type=LOC_SHARDING
spring.shardingsphere.rules.sharding.sharding-algorithms.loc-sharding.props.day-size=380
--
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] SkySun90 edited a comment on issue #10633: Default not configured sharding.key-generators. Project startup error reported
Posted by GitBox <gi...@apache.org>.
SkySun90 edited a comment on issue #10633:
URL: https://github.com/apache/shardingsphere/issues/10633#issuecomment-872802929
mark. 遇到同样问题。配置如下
#shardingsphere配置
spring.shardingsphere.datasource.names=db0
spring.shardingsphere.datasource.common.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.db0.url=jdbc:mysql://XX:XX/XXX?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
spring.shardingsphere.datasource.db0.username=XXX
spring.shardingsphere.datasource.db0.password=XXX
#sharding分表配置
spring.shardingsphere.rules.sharding.tables.tb_demo.actual-data-nodes=db0.tb_demo
spring.shardingsphere.rules.sharding.tables.tb_demo.database-strategy.standard.sharding-column=push_date
spring.shardingsphere.rules.sharding.tables.tb_demo.database-strategy.standard.sharding-algorithm-name=loc-date-sharding
# 分片算法配置
spring.shardingsphere.rules.sharding.sharding-algorithms.loc-sharding.type=LOC_SHARDING
spring.shardingsphere.rules.sharding.sharding-algorithms.loc-sharding.props.day-size=380
--
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] SkySun90 edited a comment on issue #10633: Default not configured sharding.key-generators. Project startup error reported
Posted by GitBox <gi...@apache.org>.
SkySun90 edited a comment on issue #10633:
URL: https://github.com/apache/shardingsphere/issues/10633#issuecomment-872802929
mark. 遇到同样问题。配置如下
#shardingsphere配置
spring.shardingsphere.datasource.names=db0
spring.shardingsphere.datasource.common.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.db0.url=jdbc:mysql://XX:XX/XXX?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
spring.shardingsphere.datasource.db0.username=XXX
spring.shardingsphere.datasource.db0.password=XXX
#sharding分表配置
spring.shardingsphere.rules.sharding.tables.tb_demo.actual-data-nodes=db0.tb_demo
spring.shardingsphere.rules.sharding.tables.tb_demo.database-strategy.standard.sharding-column=push_date
spring.shardingsphere.rules.sharding.tables.tb_demo.database-strategy.standard.sharding-algorithm-name=loc-date-sharding
#分片算法配置
spring.shardingsphere.rules.sharding.sharding-algorithms.loc-sharding.type=LOC_SHARDING
spring.shardingsphere.rules.sharding.sharding-algorithms.loc-sharding.props.day-size=380
--
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