YanlongMa edited a comment on issue #9091:
URL: https://github.com/apache/shardingsphere/issues/9091#issuecomment-763256441
zookeeper config center is success, but etcd config center is error, I
dont‘not how to add dependency in pom, can you help me, 3Q.
pom.xml
```
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-orchestration-spring-boot-starter</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>io.etcd</groupId>
<artifactId>jetcd-core</artifactId>
<version>0.5.0</version>
</dependency>
```
properties
```
spring.shardingsphere.datasource.names=master,slave0,slave1
# master
spring.shardingsphere.datasource.master.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.master.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.master.jdbc-url=jdbc:mysql://127.0.0.1:3306/master?useUnicode=true&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.master.username=root
spring.shardingsphere.datasource.master.password=123456
# slave0
spring.shardingsphere.datasource.slave0.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.slave0.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.slave0.jdbc-url=jdbc:mysql://127.0.0.1:3306/slave0?useUnicode=true&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.slave0.username=root
spring.shardingsphere.datasource.slave0.password=123456
# slave1
spring.shardingsphere.datasource.slave1.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.slave1.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.slave1.jdbc-url=jdbc:mysql://127.0.0.1:3306/slave1?useUnicode=true&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.slave1.username=root
spring.shardingsphere.datasource.slave1.password=123456
# round_robin/random
spring.shardingsphere.masterslave.name=kushu_taishan
spring.shardingsphere.masterslave.master-data-source-name=master
spring.shardingsphere.masterslave.slave-data-source-names=slave0,slave1
spring.shardingsphere.masterslave.load-balance-algorithm-type=round_robin
# sql
spring.shardingsphere.props.sql.show=true
# etcd
spring.shardingsphere.orchestration.name=basic
spring.shardingsphere.orchestration.overwrite=true
spring.shardingsphere.orchestration.registry.type=etcd
spring.shardingsphere.orchestration.registry.namespace=kushu_taishan
spring.shardingsphere.orchestration.registry.server-lists=127.0.0.1:2379
```
error info
```
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'sqlSessionFactory' defined in class path
resource
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]:
Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter
0; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'masterSlaveDataSourceByLocal' defined in class
path resource
[org/apache/shardingsphere/shardingjdbc/orchestration/spring/boot/OrchestrationSpringBootConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[javax.sql.DataSource]: Factory method 'masterSlaveDataSourceByLocal' threw
exception; nested exception is java.lang.RuntimeException: Invalid
`org.apache.shardingsphere.orchestration.reg.api.RegistryCenter` SPI type
`etcd`.
at
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:799)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:540)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1509)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
... 49 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'masterSlaveDataSourceByLocal' defined in class path
resource
[org/apache/shardingsphere/shardingjdbc/orchestration/spring/boot/OrchestrationSpringBootConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[javax.sql.DataSource]: Factory method 'masterSlaveDataSourceByLocal' threw
exception; nested exception is java.lang.RuntimeException: Invalid
`org.apache.shardingsphere.orchestration.reg.api.RegistryCenter` SPI type
`etcd`.
at
org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:637)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:886)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:790)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
... 62 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.sql.DataSource]: Factory method
'masterSlaveDataSourceByLocal' threw exception; nested exception is
java.lang.RuntimeException: Invalid
`org.apache.shardingsphere.orchestration.reg.api.RegistryCenter` SPI type
`etcd`.
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:652)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
... 76 common frames omitted
Caused by: java.lang.RuntimeException: Invalid
`org.apache.shardingsphere.orchestration.reg.api.RegistryCenter` SPI type
`etcd`.
at
org.apache.shardingsphere.spi.TypeBasedSPIServiceLoader.newService(TypeBasedSPIServiceLoader.java:50)
~[shardingsphere-spi-4.0.0.jar:4.0.0]
at
org.apache.shardingsphere.orchestration.internal.registry.RegistryCenterServiceLoader.load(RegistryCenterServiceLoader.java:52)
~[sharding-orchestration-core-4.0.0.jar:4.0.0]
at
org.apache.shardingsphere.orchestration.internal.registry.ShardingOrchestrationFacade.<init>(ShardingOrchestrationFacade.java:58)
~[sharding-orchestration-core-4.0.0.jar:4.0.0]
at
org.apache.shardingsphere.shardingjdbc.orchestration.internal.datasource.OrchestrationMasterSlaveDataSource.<init>(OrchestrationMasterSlaveDataSource.java:70)
~[sharding-jdbc-orchestration-4.0.0.jar:4.0.0]
at
org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration.masterSlaveDataSourceByLocal(OrchestrationSpringBootConfiguration.java:144)
~[sharding-jdbc-orchestration-spring-boot-starter-4.0.0.jar:4.0.0]
at
org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration$$EnhancerBySpringCGLIB$$650690ac.CGLIB$masterSlaveDataSourceByLocal$3(<generated>)
~[sharding-jdbc-orchestration-spring-boot-starter-4.0.0.jar:4.0.0]
at
org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration$$EnhancerBySpringCGLIB$$650690ac$$FastClassBySpringCGLIB$$812f0b91.invoke(<generated>)
~[sharding-jdbc-orchestration-spring-boot-starter-4.0.0.jar:4.0.0]
at
org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
~[spring-core-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at
org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration$$EnhancerBySpringCGLIB$$650690ac.masterSlaveDataSourceByLocal(<generated>)
~[sharding-jdbc-orchestration-spring-boot-starter-4.0.0.jar:4.0.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[na:1.8.0_231]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[na:1.8.0_231]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.8.0_231]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_231]
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
... 77 common frames omitted
Process finished with exit code 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.
For queries about this service, please contact Infrastructure at:
[email protected]