spring-cloud / spring-cloud-consul

Spring Cloud Consul
http://cloud.spring.io/spring-cloud-consul/
Apache License 2.0
812 stars 541 forks source link

java.lang.IllegalStateException: Must have one of ConsulRegistration or ConsulLifecycle #325

Closed keets2012 closed 7 years ago

keets2012 commented 7 years ago

when I upgrade cloud version ,My API gateway throws following exception.

spring-cloud.version: Dalston.RELEASE spring-boot.version: 1.5.3.RELEASE spring.consul.version: 1.2.0.RELEASE

2017-06-26 20:22:26.531  WARN 39900 --- [           main] .s.c.n.z.f.d.DiscoveryClientRouteLocator : Error locating local service instance

java.lang.IllegalStateException: Must have one of ConsulRegistration or ConsulLifecycle
        at org.springframework.cloud.consul.discovery.ConsulDiscoveryClientConfiguration$LifecycleRegistrationResolver.getInstanceId(ConsulDiscoveryClientConfiguration.java:95) ~[spring-cloud-consul-discovery-1.2.0.RELEASE.jar:1.2.0.RELEASE]
        at org.springframework.cloud.consul.discovery.ConsulDiscoveryClient.getLocalServiceInstance(ConsulDiscoveryClient.java:95) ~[spring-cloud-consul-discovery-1.2.0.RELEASE.jar:1.2.0.RELEASE]
        at org.springframework.cloud.netflix.zuul.filters.discovery.DiscoveryClientRouteLocator.<init>(DiscoveryClientRouteLocator.java:62) [spring-cloud-netflix-core-1.3.0.RELEASE.jar:1.3.0.RELEASE]
        at org.springframework.cloud.netflix.zuul.filters.discovery.DiscoveryClientRouteLocator.<init>(DiscoveryClientRouteLocator.java:80) [spring-cloud-netflix-core-1.3.0.RELEASE.jar:1.3.0.RELEASE]
        at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration.discoveryRouteLocator(ZuulProxyConfiguration.java:81) [spring-cloud-netflix-core-1.3.0.RELEASE.jar:1.3.0.RELEASE]
        at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$b4fdd660.CGLIB$discoveryRouteLocator$2(<generated>) [spring-cloud-netflix-core-1.3.0.RELEASE.jar:1.3.0.RELEASE]
        at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$b4fdd660$$FastClassBySpringCGLIB$$453f353b.invoke(<generated>) [spring-cloud-netflix-core-1.3.0.RELEASE.jar:1.3.0.RELEASE]
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) [spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$b4fdd660.discoveryRouteLocator(<generated>) [spring-cloud-netflix-core-1.3.0.RELEASE.jar:1.3.0.RELEASE]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1309) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1275) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1180) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1096) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) [spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
keets2012 commented 7 years ago

ok, I fix this.

spencergibb commented 7 years ago

Duplicates https://github.com/spring-cloud/spring-cloud-netflix/issues/2083