15898317421 commented on issue #9741:
URL: https://github.com/apache/shardingsphere/issues/9741#issuecomment-804536581
Here is the exception stack and properties configuration, and I want to know
what the work-id is in properties.
The only difference is version 4.0.0 and 5.0.0, other is the same completely
such as the code.
stack of exception
2021-03-23 10:23:05 [ INFO ] [ null ] [ null ] [ null ] [ null:null ] [ ] [
main ] [ SpringApplication.java:675 ] [ logStartupProfileInfo ] [ - ] [ - ] [ -
] - No active profile set, falling back to default profiles: default
2021-03-23 10:23:06 [ ERROR ] [ null ] [ null ] [ null ] [ null:null ] [ ]
[ main ] [ SpringApplication.java:858 ] [ reportFailure ] [ - ] [ - ] [ - ] -
Application run failed
java.lang.reflect.InvocationTargetException: null
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.lambda$registerBean$1(AbstractAlgorithmProvidedBeanRegistry.java:57)
at java.lang.Iterable.forEach(Iterable.java:75)
at
org.apache.shardingsphere.spring.boot.registry.AbstractAlgorithmProvidedBeanRegistry.registerBean(AbstractAlgorithmProvidedBeanRegistry.java:55)
at
org.apache.shardingsphere.sharding.spring.boot.algorithm.ShardingAlgorithmProvidedBeanRegistry.postProcessBeanDefinitionRegistry(ShardingAlgorithmProvidedBeanRegistry.java:38)
at
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
at
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:125)
at
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at com.idanchuang.project.basic.Application.main(Application.java:18)
Caused by: java.util.NoSuchElementException: No value bound
at
org.springframework.boot.context.properties.bind.BindResult.get(BindResult.java:56)
... 21 common frames omitted
2021-03-23 10:23:06 [ WARN ] [ null ] [ null ] [ null ] [ null:null ] [ ] [
main ] [ Dsn.java:102 ] [ dsnFrom ] [ - ] [ - ] [ - ] - *** Couldn't find a
suitable DSN, Sentry operations will do nothing! See documentation:
https://docs.sentry.io/clients/java/ ***
2021-03-23 10:23:06 [ WARN ] [ null ] [ null ] [ null ] [ null:null ] [ ] [
main ] [ DefaultSentryClientFactory.java:556 ] [ getInAppFrames ] [ - ] [ - ] [
- ] - No 'stacktrace.app.packages' was configured, this option is highly
recommended as it affects stacktrace grouping and display on Sentry. See
documentation:
https://docs.sentry.io/clients/java/config/#in-application-stack-frames
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at
org.springframework.util.ReflectionUtils.rethrowRuntimeException(ReflectionUtils.java:354)
at
org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:841)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at com.idanchuang.project.basic.Application.main(Application.java:18)
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.lambda$registerBean$1(AbstractAlgorithmProvidedBeanRegistry.java:57)
at java.lang.Iterable.forEach(Iterable.java:75)
at
org.apache.shardingsphere.spring.boot.registry.AbstractAlgorithmProvidedBeanRegistry.registerBean(AbstractAlgorithmProvidedBeanRegistry.java:55)
at
org.apache.shardingsphere.sharding.spring.boot.algorithm.ShardingAlgorithmProvidedBeanRegistry.postProcessBeanDefinitionRegistry(ShardingAlgorithmProvidedBeanRegistry.java:38)
at
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
at
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:125)
at
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
... 3 more
Caused by: java.util.NoSuchElementException: No value bound
at
org.springframework.boot.context.properties.bind.BindResult.get(BindResult.java:56)
... 21 more
properties of application
server.port=8080
spring.application.name=dynamic-datasource-sharding-spring
spring.shardingsphere.props.show-sql=true
# sharding sphere data source name for spring
spring.shardingsphere.datasource.names=ds0
# sharding sphere data source configuration for spring
spring.shardingsphere.datasource.ds0.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.ds0.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:mysql://localhost:3316/demo1
spring.shardingsphere.datasource.ds0.username=root
spring.shardingsphere.datasource.ds0.password=123456
# table sharding with 4.0.0 version
#spring.shardingsphere.sharding.tables.demo_one.actual-data-nodes =
ds${0}.demo_one_${0..1}
#spring.shardingsphere.sharding.tables.demo_one.table-strategy.inline.sharding-column
= sharding_id
#spring.shardingsphere.sharding.tables.demo_one.table-strategy.inline.algorithm-expression
= demo_one_${sharding_id % 2}
#spring.shardingsphere.sharding.tables.demo_one.key-generator.column =
sharding_id
#spring.shardingsphere.sharding.tables.demo_one.key-generator.type =
SNOWFLAKE
#sharding rules configuration with 5.0.0 version
spring.shardingsphere.sharding.tables.demo_one.actual-data-nodes =
ds$->{0}.demo_one_$->{0..1}
spring.shardingsphere.sharding.tables.demo_one.table-strategy.standard.sharding-column=sharding_id
spring.shardingsphere.sharding.tables.demo_one.table-strategy.standard.sharding-algorithm-name=demo-one-table-strategy-inline
#sharding algorithms configuration 5.0.0 version
spring.shardingsphere.rules.sharding.sharding-algorithms.demo-one-table-strategy-inline.type=INLINE
spring.shardingsphere.rules.sharding.sharding-algorithms.demo-one-table-strategy-inline.algorithm-expression=demo_one_$->{sharding_id
% 2}
#key generate strategy configuration 5.0.0 version
spring.shardingsphere.rules.sharding.tables.demo_one.key-generate-strategy.column=sharding_id
spring.shardingsphere.rules.sharding.tables.demo_one.key-generate-strategy.key-generator-name=snowflake
#key generators configuration 5.0.0 version
spring.shardingsphere.rules.sharding.key-generators.snowflake.type=SNOWFLAKE
spring.shardingsphere.rules.sharding.key-generators.snowflake.props.worker-id=
--
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:
[email protected]