赞
踩
最近使用了SpringCloud2.2.5版本的,调用微服务,总是报一下错误。网上找了各种文章都没有解决问题。
我分析了一下原因,主要是调用端没有找到服务列表,如下。动态服务列表是空的。
c.n.l.DynamicServerListLoadBalancer : Using serverListUpdater PollingServerListUpdater
2020-02-21 10:18:08.278 INFO 11688 --- [io-19603-exec-1] c.n.l.DynamicServerListLoadBalancer : DynamicServerListLoadBalancer for client CRUDER initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=CRUDER,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@1030a86f
2020-02-21 10:18:08.310 ERROR 11688 --- [io-19603-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: No instances available for CRUDER] with root cause
java.lang.IllegalStateException: No instances available for
经过探索,发现问题出在了一下部分。在配置文件application.yml文件中:
eureka:
instance:
hostname: localhost
client:
registerWithEureka: true
fetchRegistry: false
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:9871/eureka/
红色部位改为true,就可以了。
好了祝大家鼠年好运
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。