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

错误消息:

com.netflix.client.ClientException: Load balancer does not have available server for client: userservice
 at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:483) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
 at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
 at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
 at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8]
 at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94) ~[rxjava-1.3.8.jar:1.3.8]
 at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42) ~[rxjava-1.3.8.jar:1.3.8]
 at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8]
 at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber$1.call(OperatorRetryWithPredicate.java:127) ~[rxjava-1.3.8.jar:1.3.8]
 at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.enqueue(TrampolineScheduler.java:73) ~[rxjava-1.3.8.jar:1.3.8]
 at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.schedule(TrampolineScheduler.java:52) ~[rxjava-1.3.8.jar:1.3.8]
 at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:79) ~[rxjava-1.3.8.jar:1.3.8]
 at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:45) ~[rxjava-1.3.8.jar:1.3.8]
 at rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:276) ~[rxjava-1.3.8.jar:1.3.8]
 at rx.Subscriber.setProducer(Subscriber.java:209) ~[rxjava-1.3.8.jar:1.3.8]
 at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:138) ~[rxjava-1.3.8.jar:1.3.8]
 at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:

错误分析

服务实例没有被加载到,网上出现这种错误好像还是挺多的,在此写下本人出现该错误的地方及解决方式,也可能是其他错误地方,希望能帮到遇到同样错误的朋友。
com.netflix.client.ClientException: Load balancer does not have available server for client: userser_第1张图片
我这里两个环境出现了隔离,但是我记得自己已经配置了namespce都配置在了dev环境下
观察配置文件如下(这里用bootsrap.yml作为userservice环境共享配置文件)
com.netflix.client.ClientException: Load balancer does not have available server for client: userser_第2张图片

解决问题

上图出现了问题,namespce注册到Nacos前缀并不是config,而是discovery
粗心可能就这样了
com.netflix.client.ClientException: Load balancer does not have available server for client: userser_第3张图片

正确配置如下 :
com.netflix.client.ClientException: Load balancer does not have available server for client: userser_第4张图片
当然order-service也要在相同的namespce下,也可以配置文件都不配置namespace,在nacos中直接默认在public
com.netflix.client.ClientException: Load balancer does not have available server for client: userser_第5张图片
com.netflix.client.ClientException: Load balancer does not have available server for client: userser_第6张图片
最后测试成功!!

你可能感兴趣的:(bug,java,bug,feign,nacos)