java.lang.IllegalStateException: No instances available for 的一种解决思路

 最近使用了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,就可以了。

好了祝大家鼠年好运

  • 6
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值