eureka错误:
java.lang.IllegalStateException: No instances available for order-service at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:119) ~[spring-cloud-netflix-ribbon-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:99) ~[spring-cloud-netflix-ribbon-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor.intercept(LoadBalancerInterceptor.java:58) ~[spring-cloud-commons-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:92) ~[spring-web-5.1.14.RELEASE.jar:5.1.14.RELEASE] at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:76) ~[spring-web-5.1.14.RELEASE.jar:5.1.14.RELEASE] at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) ~[spring-web-5.1.14.RELEASE.jar:5.1.14.RELEASE] at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53) ~[spring-web-5.1.14.RELEASE.jar:5.1.14.RELEASE] at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:733) ~[spring-web-5.1.14.RELEASE.jar:5.1.14.RELEASE] at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:668) ~[spring-web-5.1.14.RELEASE.jar:5.1.14.RELEASE]
解决:
无法获取到服务地址,先检查了一下服务名,正确的,eureka中也有,那么还没有获取到服务只能是我没有让他获取了,改:fetch-registry: true
成功
yml配置:
eureka: client: service-url: # EurekaServer地址 defaultZone: http://127.0.0.1:10086/eureka register-with-eureka: true #自己就是注册中心,不用注册自己 fetch-registry: true #要不要去注册中心获取其他服务的地址 只有获取了地址才能使用