Feign报错Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client

问题描述

使用Feign调用微服务接口报错,如下:

java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: app1
    at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:71)
    at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:97)
    at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)
    at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:108)
    at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)
    at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.Observable.unsafeSubscribe(Observable.java:10211)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
    at rx.Observable.unsafeSubscribe(Observable.java:10211)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
    at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.Observable.unsafeSubscribe(Observable.java:10211)
    at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)
    at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)
    at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)
    at org.springframework.security.concurrent.DelegatingSecurityContextCallable.call(DelegatingSecurityContextCallable.java:86)
    at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)
    at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: app1
    at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:483)
    at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184)
    at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180)
    at rx.Observable.unsafeSubscribe(Observable.java:10211)
    at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)
    at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.Observable.subscribe(Observable.java:10307)
    at rx.Observable.subscribe(Observable.java:10274)
    at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:445)
    at rx.observables.BlockingObservable.single(BlockingObservable.java:342)
    at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:117)
    at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:63)
    ... 33 common frames omitted

问题解决

原因可能有两个:

  • 1.没有引入Eureka依赖
  • [email protected]注解中name写错,比如这次我按照教程以为name写app1就好,其实不然……

1.引入依赖

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>

2.将name修改正确的被调用服务的spring.application.name名称

原文地址:https://www.cnblogs.com/hellxz/p/8920378.html

时间: 2024-10-27 12:13:47

Feign报错Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client的相关文章

com.netflix.client.ClientException: Load balancer does not have available server for client: provider-user

在使用feign远程调用的时候启动项目报错. 报错信息如下: com.netflix.client.ClientException: Load balancer does not have available server for client:xxx 解决方法: 在客户端 (消费者) 的application.yml文件中添加以下配置即可 ribbon: eureka: enabled: true 原文地址:https://www.cnblogs.com/jack-zhou21235/p/12

com.netflix.client.ClientException: Load balancer does not have available server for client xxxx

版本spring boot: 2.0.1.RELEASE spring cloud: Finchley.M9 错误通过zuul调用eureka注册的服务,错误内容如下 Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client xxxxx 方案经过查询排查,两种解决方案 方案一(亲测有效) 在application.properties中添加 ribb

com.netflix.client.ClientException: Load balancer does not have available server for client:xxx

重启一个web模块,刷新页面报错, 负载均衡器没有可用的服务器给客户端:在网关添加. 1 ribbon: 2 eureka: 3 enabled: true 原文地址:https://www.cnblogs.com/yz0812/p/10195066.html

Load balancer does not have available server for client

最近在研究spring-cloud,研究zuul组件时发生下列错误: Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: zuul-server 解决办法就是在pom文件里添加 <dependency> <groupId>org.springframework.cloud</groupId> <artifact

load balancer does not have available server for client: provider

Ask Question up vote6down votefavorite 4 I'm trying to use Feign client. Below is my feing client: import com.eprogrammerz.examples.domain.Movie; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.web.bind.annotati

多线程AsyncTask中使用Jsoup 报错Caused by: java.lang.NoClassDefFoundError: org.jsoup.Jsoup

代码如下,在多线程AsyncTask类中的doInBackground调用Jsoup protected String doInBackground(String... params) { // TODO Auto-generated method stub Log.i(TAG, "doInBackground(Params... params) called"); try { Document doc=Jsoup.connect(params[0]).get(); Elements

spring-framework-3.2.4.RELEASE 整合hibernate-release-4.3.5.Final报错Caused by: java.lang.NoClassDefFound

LZ今天整合spring-framework-3.2.4.RELEASE 整合hibernate-release-4.3.5.Final报错Caused by: java.lang.NoClassDefFound Caused by: java.lang.NoClassDefFoundError: org/hibernate/service/jta/platform/spi/JtaPlatform. 最后从国外一篇文章找到解决办法:原文地址如下:点击打开链接 产生原因是: Hibernate4.

./redis-trib.rb 报错:/usr/local/rvm/gems/ruby-2.4.2/gems/redis-4.0.1/lib/redis/client.rb:119:in `call&#39;: ERR Slot 0 is already busy (Redis::CommandError)

错误提示是 slot插槽被占用了(这是 搭建集群前时,以前redis的旧数据和配置信息没有清理干净.) 解决方案是 用redis-cli 登录到每个节点执行  flushall  和 cluster reset  就可以了. 然后重新执行群集脚本命令: ./redis-trib.rb create --replicas 1 192.168.*.*:7001 192.168.*.*:7002 192.168.*.*:7003 192.168.*.*:7004 192.168.*.*:7005  1

使用Linux调用资源库中的Job报错-ERROR: No repository provided, can&#39;t load job.

使用kettle调用资源库中的作业或者是转换,需要注意一下两个问题: 问题一:(-rep后不需要IP)标准shell代码如下 #!/bin/bash export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51-2.4.5.5.el7.x86_64/jre export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools