0

我已经安装并使用以下命令,使用我的系统上搬运工运行领事:弹簧启动客户无从下手领事

sudo docker run -p 8500:8500 consul:0.9.2 

领事运行良好,我可以从领事UI(图片附后检查):

enter image description here

现在,我想经营我的弹簧启动服务使用这个实例领事服务发现和注册。但是,每当我开始它给了我以下异常:

2017-09-02 18:58:17.091 ERROR 5578 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul. 
2017-09-02 18:58:18.183 ERROR 5578 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul. 
2017-09-02 18:58:19.375 ERROR 5578 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul. 
2017-09-02 18:58:20.691 ERROR 5578 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul. 
2017-09-02 18:58:22.114 ERROR 5578 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul. 
2017-09-02 18:58:23.671 ERROR 5578 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul. 
2017-09-02 18:58:23.691 ERROR 5578 --- [ restartedMain] o.s.boot.SpringApplication    : Application startup failed 

com.ecwid.consul.v1.OperationException: OperationException(statusCode=500, statusMessage='Internal Server Error', statusContent='No cluster leader') 
    at com.ecwid.consul.v1.kv.KeyValueConsulClient.getKVValues(KeyValueConsulClient.java:159) 
    at com.ecwid.consul.v1.ConsulClient.getKVValues(ConsulClient.java:487) 
    at org.springframework.cloud.consul.config.ConsulPropertySource.init(ConsulPropertySource.java:66) 
    at org.springframework.cloud.consul.config.ConsulPropertySourceLocator.create(ConsulPropertySourceLocator.java:157) 
    at org.springframework.cloud.consul.config.ConsulPropertySourceLocator.locate(ConsulPropertySourceLocator.java:131) 
    at org.springframework.cloud.consul.config.ConsulPropertySourceLocator$$FastClassBySpringCGLIB$$b35ebf8.invoke(<generated>) 
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) 
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) 
    at org.springframework.retry.interceptor.RetryOperationsInterceptor$1.doWithRetry(RetryOperationsInterceptor.java:91) 
    at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:286) 
    at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:163) 
    at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:118) 
    at org.springframework.retry.annotation.AnnotationAwareRetryOperationsInterceptor.invoke(AnnotationAwareRetryOperationsInterceptor.java:152) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) 
    at org.springframework.cloud.consul.config.ConsulPropertySourceLocator$$EnhancerBySpringCGLIB$$66375879.locate(<generated>) 
    at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:93) 
    at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:567) 
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:338) 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:301) 
    at com.pyg.auth.AuthServiceApp.main(AuthServiceApp.java:71) 
    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.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) 

SpringBoot主类是注释罚款(我猜),因为我春天引导服务工作正常与其他领事例如较早。

+0

你运行领事作为一个节点或服务器?这是一个本地开发实例? – mhradek

+0

对不起你们忘了在这里更新。我从application.yml移动领事服务器和端口配置bootstrap.yml解决了我的问题。 – gschambial

回答

1

我能够从application.yml移动领事服务器和端口配置bootstrap.yml解决我的问题。

我不很了解它是如何解决以及为什么它无法从application.yml阅读。如果任何人有关于它的一些细节,pl。让我知道。