Problem description
Use feign to invoke the error of the MicroServices interface as follows:
Java.Lang.runtimeexception: com.Netflix.Client.clientexception: Load balancer does not has available server forClient:app1 at Org.springframework.Cloud.Netflix.Feign.Ribbon.loadbalancerfeignclient.Execute(Loadbalancerfeignclient.Java: in) at feign.Synchronousmethodhandler.Executeanddecode(Synchronousmethodhandler.Java: the) at feign.Synchronousmethodhandler.Invoke(Synchronousmethodhandler.Java: the) at feign.Hystrix.Hystrixinvocationhandler$1.Run(Hystrixinvocationhandler.Java:108) at COM.Netflix.Hystrix.Hystrixcommand$2.Pager(Hystrixcommand.Java:302) at COM.Netflix.Hystrix.Hystrixcommand$2.Pager(Hystrixcommand.Java:298) at Rx.Internal.operators.Onsubscribedefer.Pager(Onsubscribedefer.Java: $) at Rx.Internal.operators.Onsubscribedefer.Pager(Onsubscribedefer.Java: *) at Rx.Internal.operators.Onsubscribelift.Pager(Onsubscribelift.Java: -) at Rx.Internal.operators.Onsubscribelift.Pager(Onsubscribelift.Java: -) at Rx.Internal.operators.Onsubscribelift.Pager(Onsubscribelift.Java: -) at Rx.Internal.operators.Onsubscribelift.Pager(Onsubscribelift.Java: -) at Rx.Internal.operators.Onsubscribelift.Pager(Onsubscribelift.Java: -) at Rx.Internal.operators.Onsubscribelift.Pager(Onsubscribelift.Java: -) at Rx.Observable.Unsafesubscribe(Observable.Java:10211) at Rx.Internal.operators.Onsubscribedefer.Pager(Onsubscribedefer.Java:Wuyi) at Rx.Internal.operators.Onsubscribedefer.Pager(Onsubscribedefer.Java: *) at Rx.Observable.Unsafesubscribe(Observable.Java:10211) at Rx.Internal.operators.Onsubscribedooneach.Pager(Onsubscribedooneach.Java: A) at Rx.Internal.operators.Onsubscribedooneach.Pager(Onsubscribedooneach.Java: -) at Rx.Internal.operators.Onsubscribelift.Pager(Onsubscribelift.Java: -) at Rx.Internal.operators.Onsubscribelift.Pager(Onsubscribelift.Java: -) at Rx.Observable.Unsafesubscribe(Observable.Java:10211) at Rx.Internal.operators.Operatorsubscribeon$1.Pager(Operatorsubscribeon.Java:94) at COM.Netflix.Hystrix.Strategy.Concurrency.hystrixcontexscheduleraction$1.Pager(Hystrixcontexscheduleraction.Java: About) at COM.Netflix.Hystrix.Strategy.Concurrency.hystrixcontexscheduleraction$1.Pager(Hystrixcontexscheduleraction.Java: -) at Org.springframework.Security.Concurrent.delegatingsecuritycontextcallable.Pager(delegatingsecuritycontextcallable.Java: the) at COM.Netflix.Hystrix.Strategy.Concurrency.hystrixcontexscheduleraction.Pager(Hystrixcontexscheduleraction.Java: the) at Rx.Internal.schedulers.scheduledaction.Run(Scheduledaction.Java: -) at Java.util.Concurrent.Executors$RunnableAdapter.Pager(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 has available server forClient:app1 at COM.Netflix.LoadBalancer.Loadbalancercontext.Getserverfromloadbalancer(Loadbalancercontext.Java:483) at COM.Netflix.LoadBalancer.Reactive.Loadbalancercommand$1.Pager(Loadbalancercommand.Java:184) at COM.Netflix.LoadBalancer.Reactive.Loadbalancercommand$1.Pager(Loadbalancercommand.Java: the) at Rx.Observable.Unsafesubscribe(Observable.Java:10211) at Rx.Internal.operators.Onsubscribeconcatmap.Pager(Onsubscribeconcatmap.Java:94) at Rx.Internal.operators.Onsubscribeconcatmap.Pager(Onsubscribeconcatmap.Java: the) at Rx.Internal.operators.Onsubscribelift.Pager(Onsubscribelift.Java: -) at Rx.Internal.operators.Onsubscribelift.Pager(Onsubscribelift.Java: -) at Rx.Internal.operators.Onsubscribelift.Pager(Onsubscribelift.Java: -) at Rx.Internal.operators.Onsubscribelift.Pager(Onsubscribelift.Java: -) 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: the)... -Common frames omitted
There are two possible reasons for a problem resolution:
- 1. Eureka Dependency not introduced
- [email protected] The name is wrong in the note, such as this time I follow the tutorial as a name to write App1, it is not ...
1. Introduction of dependency
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> </dependency>
2. Modify the name of the correct spring.application.name for the invoked service
Feign error caused By:com.netflix.client.ClientException:Load balancer does not having available server for client