2017-04-16 00:18:17.613 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@5b799640: startup date [Sun Apr 16 00:18:17 CST 2017]; root of context hierarchy
2017-04-16 00:18:17.877 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2017-04-16 00:18:17.912 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$51a6ef79] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-04-16 00:18:18.349 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2017-04-16 00:18:18.420 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2017-04-16 00:18:18.674 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2017-04-16 00:18:18.674 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2017-04-16 00:18:18.744 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2017-04-16 00:18:18.745 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2017-04-16 00:18:18.894 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2017-04-16 00:18:18.897 WARN [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Invalid eureka server URI: http://${eureka.instance.hostname}:${eureka.server.port}/eureka/; removing from the server pool
2017-04-16 00:18:18.897 ERROR [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Cannot resolve to any endpoints from provided configuration: {defaultZone=[http://${eureka.instance.hostname}:${eureka.server.port}/eureka/]}
2017-04-16 00:18:19.009 ERROR [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] c.n.d.s.transport.EurekaHttpClients : Initial resolution of Eureka server endpoints failed. Check ConfigClusterResolver logs for more info
2017-04-16 00:18:19.021 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2017-04-16 00:18:19.022 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2017-04-16 00:18:19.022 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2017-04-16 00:18:19.022 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] com.netflix.discovery.DiscoveryClient : Application is null : false
2017-04-16 00:18:19.022 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2017-04-16 00:18:19.022 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2017-04-16 00:18:19.023 INFO [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2017-04-16 00:18:19.027 ERROR [water-cloud-provider-uac,,,] [water-cloud-provider-uac,,,,] 9096 --- [ main] com.netflix.discovery.DiscoveryClient : DiscoveryClient_WATER-CLOUD-PROVIDER-UAC/DESKTOP-R9436U1:water-cloud-provider-uac - was unable to refresh its cache! status = There is no known eureka server; cluster server list is empty
com.netflix.discovery.shared.transport.TransportException: There is no known eureka server; cluster server list is empty
at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:107)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137)
at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
at com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.java:1013)
at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:927)
at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:408)
at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:266)
at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:262)
at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.java:60)
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$EurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:195)
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$EurekaClientConfiguration$$EnhancerBySpringCGLIB$$b54d3e79.CGLIB$eurekaClient$0(<generated>)
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$EurekaClientConfiguration$$EnhancerBySpringCGLIB$$b54d3e79$$FastClassBySpringCGLIB$$5f1fad18.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$EurekaClientConfiguration$$EnhancerBySpringCGLIB$$b54d3e79.eurekaClient(<generated>)
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:497)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:175)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:98)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:64)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:73)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:336)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
at com.liuzm.cloud.water.provider.WaterCloudProviderUacApplication.main(WaterCloudProviderUacApplication.java:12)
说一下原因,占位符本身并没有问题。
问题在于eureka这里用了占位符。试想一下,现在是要先连上eureka,然后才能知道注册到eureka的config server的service-id而现在你都没有连上config server,试问要如何知道eureka那一行的占位符的值是什么呢?
把config server注册到eureka server上这种场景,叫discovery bootstrap first
-
直接配置config server的地址,叫config bootstrap first
http://cloud.spring.io/spring-cloud-static/Dalston.RELEASE/#config-first-bootstrap