feign:com.netflix.client.ClientException:负载均衡器没有客户端的可用服务器:xxx

时间:2017-11-06 11:01:25

标签: spring-cloud-feign

使用spring cloud feign时遇到一些问题: 当我使用这些代码时效果很好,

@Service
@FeignClient(name = "MS-ASSET-SECURITYTEST",value="MS-ASSET-SECURITYTEST" ,fallback = AssetServiceFallback.class, url="http://192.168.66.158:8066"))
public interface AssetService {
xxxxxxx
}

但是当我改变这样的代码时,当我调用这个feignclient的方法时,它会报告一个异常:

  

com.netflix.client.ClientException:负载均衡器没有   客户端的可用服务器:xxx

@Service
@FeignClient(value = "MS-ASSET-SECURITYTEST", fallback = AssetServiceFallback.class))
public interface AssetService {
xxx
}

下面是异常的完整信息:

  

java.lang.RuntimeException:com.netflix.client.ClientException:负载均衡器没有客户端的可用服务器:   MS-ASSET-SECURITYTEST         在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)         在feign.hystrix.HystrixInvocationHandler $ 1.run(HystrixInvocationHandler.java:108)         在com.netflix.hystrix.HystrixCommand $ 2.call(HystrixCommand.java:302)         在com.netflix.hystrix.HystrixCommand $ 2.call(HystrixCommand.java:298)         在rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)         在rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)         at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)         在rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)         at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)         在rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)         at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)         在rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)         at rx.Observable.unsafeSubscribe(Observable.java:10211)         在rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)         在rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)         at rx.Observable.unsafeSubscribe(Observable.java:10211)         在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)         在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)         在com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction $ 1.call(HystrixContexSchedulerAction.java:47)         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)         在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)         at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)         在java.lang.Thread.run(Thread.java:745)       引起:com.netflix.client.ClientException:负载均衡器没有客户端的可用服务器:MS-ASSET-SECURITYTEST         at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:483)         在com.netflix.loadbalancer.reactive.LoadBalancerCommand $ 1.call(LoadBalancerCommand.java:184)         在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.Observable.unsafeSubscribe(Observable.java:10211)         at rx.internal.operators.OperatorRetryWithPredicate $ SourceSubscriber $ 1.call(OperatorRetryWithPredicate.java:127)         在rx.internal.schedulers.TrampolineScheduler $ InnerCurrentThreadScheduler.enqueue(TrampolineScheduler.java:73)         at rx.internal.schedulers.TrampolineScheduler $ InnerCurrentThreadScheduler.schedule(TrampolineScheduler.java:52)         at rx.internal.operators.OperatorRetryWithPredicate $ SourceSubscriber.onNext(OperatorRetryWithPredicate.java:79)         at rx.internal.operators.OperatorRetryWithPredicate $ SourceSubscriber.onNext(OperatorRetryWithPredicate.java:45)         at rx.internal.util.ScalarSynchronousObservable $ WeakSingleProducer.request(ScalarSynchronousObservable.java:276)         在rx.Subscriber.setProducer(Subscriber.java:209)         at rx.internal.util.ScalarSynchronousObservable $ JustOnSubscribe.call(ScalarSynchronousObservable.java:138)         at rx.internal.util.ScalarSynchronousObservable $ JustOnSubscribe.call(ScalarSynchronousObservable.java:129)         at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)         在rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)         at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)         在rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)         at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)         在rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)         在rx.Observable.subscribe(Observable.java:10307)         at rx.Observable.subscribe(Observable.java:10274)         at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:445)         在rx.observables.BlockingObservable.single(BlockingObservable.java:342)         at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:117)         在org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:63)         ...省略了32个常见帧

我已经尝试更改配置,但它完成了任何意义。 谢谢你的帮助。

0 个答案:

没有答案