- 浏览: 263563 次
- 性别:
- 来自: 北京
文章分类
最新评论
SpringCloud微服务调用时常见错误解读
***************************
2019-11-14 19:50:17.565 [TextMsgReceiverThreadInFuture-3] [ERROR] [com.yourcompany.ms.iov.utils.MqttClientSubMsgInFuture:682] - =An unknown exception is:=
java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: yourcompany-ms-platform-backend-api
at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:71) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar!/:1.4.4.RELEASE]
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:97) ~[feign-core-9.5.0.jar!/:?]
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76) ~[feign-core-9.5.0.jar!/:?]
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103) ~[feign-core-9.5.0.jar!/:?]
at com.sun.proxy.$Proxy150.add(Unknown Source) ~[?:?]
at com.yourcompany.ms.iov.utils.MqttClientSubMsgInFuture.receiveMessage(MqttClientSubMsgInFuture.java:640) [classes!/:1.0-SNAPSHOT]
at com.yourcompany.ms.iov.utils.MqttClientSubMsgInFuture.run(MqttClientSubMsgInFuture.java:284) [classes!/:1.0-SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_74]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_74]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_74]
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: yourcompany-ms-platform-backend-api
at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:483) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber$1.call(OperatorRetryWithPredicate.java:127) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.enqueue(TrampolineScheduler.java:73) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.schedule(TrampolineScheduler.java:52) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:79) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:45) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:276) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Subscriber.setProducer(Subscriber.java:209) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:138) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:129) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.subscribe(Observable.java:10247) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.subscribe(Observable.java:10214) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:444) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.observables.BlockingObservable.single(BlockingObservable.java:341) ~[rxjava-1.2.0.jar!/:1.2.0]
at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:112) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:63) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar!/:1.4.4.RELEASE]
... 13 more
******************************************************************
2019-11-14 16:47:02.136 [PollingServerListUpdater-0] [INFO ] [com.netflix.config.ChainedDynamicProperty:115] - Flipping property: yourcompany-ms-platform-backend-api.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2019-11-14 16:47:21.316 [TextMsgReceiverThreadInFuture-3] [ERROR] [com.yourcompany.ms.iov.utils.MqttClientSubMsgInFuture:682] - =An unknown exception is:=
feign.RetryableException: Read timed out executing GET http://yourcompany-ms-platform-backend-api/sendTerminalCommand/onevendor/login
at feign.FeignException.errorExecuting(FeignException.java:67) ~[feign-core-9.5.0.jar!/:?]
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:104) ~[feign-core-9.5.0.jar!/:?]
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76) ~[feign-core-9.5.0.jar!/:?]
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103) ~[feign-core-9.5.0.jar!/:?]
at com.sun.proxy.$Proxy119.login(Unknown Source) ~[?:?]
at com.yourcompany.ms.iov.utils.MqttClientSubMsgInFuture.receiveMessage(MqttClientSubMsgInFuture.java:416) [classes!/:1.0-SNAPSHOT]
at com.yourcompany.ms.iov.utils.MqttClientSubMsgInFuture.run(MqttClientSubMsgInFuture.java:284) [classes!/:1.0-SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_74]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_74]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_74]
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method) ~[?:1.8.0_74]
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[?:1.8.0_74]
at java.net.SocketInputStream.read(SocketInputStream.java:170) ~[?:1.8.0_74]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[?:1.8.0_74]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[?:1.8.0_74]
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) ~[?:1.8.0_74]
at java.io.BufferedInputStream.read(BufferedInputStream.java:345) ~[?:1.8.0_74]
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:704) ~[?:1.8.0_74]
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647) ~[?:1.8.0_74]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1536) ~[?:1.8.0_74]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) ~[?:1.8.0_74]
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[?:1.8.0_74]
at feign.Client$Default.convertResponse(Client.java:152) ~[feign-core-9.5.0.jar!/:?]
at feign.Client$Default.execute(Client.java:74) ~[feign-core-9.5.0.jar!/:?]
at org.springframework.cloud.netflix.feign.ribbon.FeignLoadBalancer.execute(FeignLoadBalancer.java:80) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar!/:1.4.4.RELEASE]
at org.springframework.cloud.netflix.feign.ribbon.FeignLoadBalancer.execute(FeignLoadBalancer.java:48) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar!/:1.4.4.RELEASE]
at com.netflix.client.AbstractLoadBalancerAwareClient$1.call(AbstractLoadBalancerAwareClient.java:104) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:303) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:287) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at rx.internal.util.ScalarSynchronousObservable$3.call(ScalarSynchronousObservable.java:231) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$3.call(ScalarSynchronousObservable.java:228) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.drain(OnSubscribeConcatMap.java:286) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.onNext(OnSubscribeConcatMap.java:144) ~[rxjava-1.2.0.jar!/:1.2.0]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:185) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber$1.call(OperatorRetryWithPredicate.java:127) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.enqueue(TrampolineScheduler.java:73) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.schedule(TrampolineScheduler.java:52) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:79) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:45) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:276) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Subscriber.setProducer(Subscriber.java:209) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:138) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:129) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.subscribe(Observable.java:10247) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.subscribe(Observable.java:10214) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:444) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.observables.BlockingObservable.single(BlockingObservable.java:341) ~[rxjava-1.2.0.jar!/:1.2.0]
at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:112) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:63) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar!/:1.4.4.RELEASE]
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:97) ~[feign-core-9.5.0.jar!/:?]
... 12 more
*******************************************************************
【关键错误】
com.netflix.client.ClientException: Load balancer does not have available server for client:
【分析】
1、首先通过错误栈确认下调用微服务的方式,通过FeginClient还是RestTemplate;
2、确认此处为FeignClient方式;
3、从错误提示解读:负载均衡器未找到可用的微服务;说明Euerka上未找到对应的微服务;
4、通过Eureka上查看提供微服务方,是否注册正常;
yourcompany-ms-platform-backend-api:18.0.5.107:18903 , yourcompany-ms-platform-backend-api:18.0.5.108:18903
Tip:正常应该为此方式;
5、检查微服务提供方是否添加如下注解:@FeignClient
6、检查微服务调用方main启动类是否添加如下注解:@SpringBootApplication
7、确认微服务提供方节点,是否端口号【18903】已Listen就绪;
telnet ip port 确认下
【关键错误】
feign.RetryableException: Read timed out executing GET http://yourcompany-ms-platform-backend-api/sendTerminalCommand/onevendor/login
【分析】
如果没有提示上面的错误【Load balancer does not have available server for client】,则考虑如下:
1> 微服务提供方本身进程是启动ok的;
2> 微服务提供方的配置也是ok的;
3> 需要检查微服务提供方,在接口运行处是否报错;
>>> 一般是微服务方进程ok,但提供服务逻辑处,连接外部资源报错,导致服务本身被访问时timeout了;
>>> 或者通过ip和port直接访问微服务提供方,是否接口本身是ok的,也可以排除此问题;
2019-11-14 19:50:17.565 [TextMsgReceiverThreadInFuture-3] [ERROR] [com.yourcompany.ms.iov.utils.MqttClientSubMsgInFuture:682] - =An unknown exception is:=
java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: yourcompany-ms-platform-backend-api
at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:71) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar!/:1.4.4.RELEASE]
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:97) ~[feign-core-9.5.0.jar!/:?]
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76) ~[feign-core-9.5.0.jar!/:?]
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103) ~[feign-core-9.5.0.jar!/:?]
at com.sun.proxy.$Proxy150.add(Unknown Source) ~[?:?]
at com.yourcompany.ms.iov.utils.MqttClientSubMsgInFuture.receiveMessage(MqttClientSubMsgInFuture.java:640) [classes!/:1.0-SNAPSHOT]
at com.yourcompany.ms.iov.utils.MqttClientSubMsgInFuture.run(MqttClientSubMsgInFuture.java:284) [classes!/:1.0-SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_74]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_74]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_74]
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: yourcompany-ms-platform-backend-api
at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:483) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber$1.call(OperatorRetryWithPredicate.java:127) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.enqueue(TrampolineScheduler.java:73) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.schedule(TrampolineScheduler.java:52) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:79) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:45) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:276) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Subscriber.setProducer(Subscriber.java:209) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:138) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:129) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.subscribe(Observable.java:10247) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.subscribe(Observable.java:10214) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:444) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.observables.BlockingObservable.single(BlockingObservable.java:341) ~[rxjava-1.2.0.jar!/:1.2.0]
at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:112) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:63) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar!/:1.4.4.RELEASE]
... 13 more
******************************************************************
2019-11-14 16:47:02.136 [PollingServerListUpdater-0] [INFO ] [com.netflix.config.ChainedDynamicProperty:115] - Flipping property: yourcompany-ms-platform-backend-api.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2019-11-14 16:47:21.316 [TextMsgReceiverThreadInFuture-3] [ERROR] [com.yourcompany.ms.iov.utils.MqttClientSubMsgInFuture:682] - =An unknown exception is:=
feign.RetryableException: Read timed out executing GET http://yourcompany-ms-platform-backend-api/sendTerminalCommand/onevendor/login
at feign.FeignException.errorExecuting(FeignException.java:67) ~[feign-core-9.5.0.jar!/:?]
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:104) ~[feign-core-9.5.0.jar!/:?]
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76) ~[feign-core-9.5.0.jar!/:?]
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103) ~[feign-core-9.5.0.jar!/:?]
at com.sun.proxy.$Proxy119.login(Unknown Source) ~[?:?]
at com.yourcompany.ms.iov.utils.MqttClientSubMsgInFuture.receiveMessage(MqttClientSubMsgInFuture.java:416) [classes!/:1.0-SNAPSHOT]
at com.yourcompany.ms.iov.utils.MqttClientSubMsgInFuture.run(MqttClientSubMsgInFuture.java:284) [classes!/:1.0-SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_74]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_74]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_74]
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method) ~[?:1.8.0_74]
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[?:1.8.0_74]
at java.net.SocketInputStream.read(SocketInputStream.java:170) ~[?:1.8.0_74]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[?:1.8.0_74]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[?:1.8.0_74]
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) ~[?:1.8.0_74]
at java.io.BufferedInputStream.read(BufferedInputStream.java:345) ~[?:1.8.0_74]
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:704) ~[?:1.8.0_74]
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647) ~[?:1.8.0_74]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1536) ~[?:1.8.0_74]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) ~[?:1.8.0_74]
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[?:1.8.0_74]
at feign.Client$Default.convertResponse(Client.java:152) ~[feign-core-9.5.0.jar!/:?]
at feign.Client$Default.execute(Client.java:74) ~[feign-core-9.5.0.jar!/:?]
at org.springframework.cloud.netflix.feign.ribbon.FeignLoadBalancer.execute(FeignLoadBalancer.java:80) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar!/:1.4.4.RELEASE]
at org.springframework.cloud.netflix.feign.ribbon.FeignLoadBalancer.execute(FeignLoadBalancer.java:48) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar!/:1.4.4.RELEASE]
at com.netflix.client.AbstractLoadBalancerAwareClient$1.call(AbstractLoadBalancerAwareClient.java:104) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:303) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:287) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at rx.internal.util.ScalarSynchronousObservable$3.call(ScalarSynchronousObservable.java:231) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$3.call(ScalarSynchronousObservable.java:228) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.drain(OnSubscribeConcatMap.java:286) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.onNext(OnSubscribeConcatMap.java:144) ~[rxjava-1.2.0.jar!/:1.2.0]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:185) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber$1.call(OperatorRetryWithPredicate.java:127) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.enqueue(TrampolineScheduler.java:73) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.schedule(TrampolineScheduler.java:52) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:79) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:45) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:276) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Subscriber.setProducer(Subscriber.java:209) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:138) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:129) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.subscribe(Observable.java:10247) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.Observable.subscribe(Observable.java:10214) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:444) ~[rxjava-1.2.0.jar!/:1.2.0]
at rx.observables.BlockingObservable.single(BlockingObservable.java:341) ~[rxjava-1.2.0.jar!/:1.2.0]
at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:112) ~[ribbon-loadbalancer-2.2.5.jar!/:2.2.5]
at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:63) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar!/:1.4.4.RELEASE]
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:97) ~[feign-core-9.5.0.jar!/:?]
... 12 more
*******************************************************************
【关键错误】
com.netflix.client.ClientException: Load balancer does not have available server for client:
【分析】
1、首先通过错误栈确认下调用微服务的方式,通过FeginClient还是RestTemplate;
2、确认此处为FeignClient方式;
3、从错误提示解读:负载均衡器未找到可用的微服务;说明Euerka上未找到对应的微服务;
4、通过Eureka上查看提供微服务方,是否注册正常;
yourcompany-ms-platform-backend-api:18.0.5.107:18903 , yourcompany-ms-platform-backend-api:18.0.5.108:18903
Tip:正常应该为此方式;
5、检查微服务提供方是否添加如下注解:@FeignClient
@FeignClient(name = "yourcompany-ms-platform-ivt-service") public interface IvtTextCmdPubRMI { }
6、检查微服务调用方main启动类是否添加如下注解:@SpringBootApplication
@EnableDiscoveryClient @EnableFeignClients(basePackages = { "com.yourcompany" }) @SpringBootApplication @ComponentScan(basePackages = { "com.yourcompany" }) public class Application { private final static String EMQX_Cluster_Topic_Name = CommonToolsUtils.generateTopic4TxtCmd2SInGroup(); public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
7、确认微服务提供方节点,是否端口号【18903】已Listen就绪;
telnet ip port 确认下
【关键错误】
feign.RetryableException: Read timed out executing GET http://yourcompany-ms-platform-backend-api/sendTerminalCommand/onevendor/login
【分析】
如果没有提示上面的错误【Load balancer does not have available server for client】,则考虑如下:
1> 微服务提供方本身进程是启动ok的;
2> 微服务提供方的配置也是ok的;
3> 需要检查微服务提供方,在接口运行处是否报错;
>>> 一般是微服务方进程ok,但提供服务逻辑处,连接外部资源报错,导致服务本身被访问时timeout了;
>>> 或者通过ip和port直接访问微服务提供方,是否接口本身是ok的,也可以排除此问题;
相关推荐
SpringCloud 微服务是当前企业级应用开发的重要框架,它为构建分布式系统提供了全面的解决方案。SpringCloud基于SpringBoot,简化了微服务架构的搭建和管理,使得开发者可以快速地在分布式环境中实现服务发现、负载...
本文来自程序猿,本文主要介绍了SpringCloud微服务下服务接口调试及管理,什么样方式可以让微服务的接口管理变得更加容易些,希望对您的学习有所帮助。我们知道在微服务架构下,软件系统会被拆分成很多个独立运行的...
【若依SpringCloud微服务版-傻瓜式教程模式】是一个面向初学者的教程,旨在帮助没有微服务架构经验的人快速上手搭建基于Spring Cloud的若依(RuoYi)微服务系统。若依是一个开源的Java管理框架,集成了Vue前端和Spring...
### 基于Spring Cloud微服务系统设计方案 #### 微服务本质 微服务架构的核心在于其分布式特性,它强调将大型复杂系统分解为一系列小型、自治的服务组件,这些组件能够独立部署、扩展和维护。相比于传统单体架构,...
**Spring Cloud**:基于Spring Boot实现的一套微服务云应用及管理开发工具,提供了在分布式系统(如配置管理、服务发现、断路器、智能路由、微代理、控制总线、一次性令牌、全局锁、领导选举、分布式会话、集群状态...
《源码-spring cloud 微服务 入门、实战与进阶》是一个涵盖Spring Cloud微服务框架的深度学习资源包,旨在帮助开发者从基础到高级全面掌握Spring Cloud的相关技术。这个压缩包的核心内容是名为"spring-cloud-master...
【SpringCloud微服务技术栈详解】 SpringCloud 是一套完整的微服务解决方案,它为开发者提供了构建分布式系统所需的工具,包括服务发现、配置管理、断路器、智能路由、微代理、控制总线、一次性令牌、全局锁、领导...
本文总结了 Spring Cloud 微服务架构笔记(一),涵盖了微服务基础知识、系统架构演变、单体应用架构、垂直应用架构、分布式 SOA 架构、微服务架构、分布式核心知识等方面的知识点。 微服务基础知识: 1. 微服务...
Spring Cloud微服务落地是一个涉及微服务架构理念、Spring Cloud相关技术栈以及企业级应用实践的综合话题。从文件内容来看,文章主要围绕京东金融在微服务方面的实践和心得,重点阐述了微服务从起步到实践的各个阶段...
再者,Spring Cloud Netflix Ribbon和Spring Cloud OpenFeign是客户端负载均衡器,它们负责在调用远程服务时进行负载均衡,提高系统的可用性。Ribbon是基于HTTP和TCP的客户端负载均衡器,而OpenFeign则提供了一种...
上传的这个microservicecloud工程的主要使用了SpringCloud的5大技术栈做了一个微服务架构案例,涉及到Eureka集群的配置、Ribbon的自定义负载均衡、Feign的声明式接口调用、Hystrix的服务熔断和降级、Zuul的Api ...
在这个名为"springcloud微服务 一个简单的微服务提供方和微服务消费者"的项目中,我们看到了微服务架构的典型实现。 首先,让我们深入了解服务提供方和服务消费者的概念。服务提供方是系统中提供特定功能或数据的...
- **接口调用**: 当一个微服务需要调用另一个微服务时,Ribbon会根据配置的负载均衡策略选择一个合适的实例进行访问。 #### 6. Ribbon 使用示例 - **配置文件**: ```yaml # 指定客户端名称 ribbon.eureka....
以下是 Spring Cloud 微服务面试题VIP典藏版,涵盖了 Spring Cloud Netflix 和 Spring Cloud Alibaba 两个主要组件,涉及到服务注册、服务发现、负载均衡、服务调用、事务管理、网关等多个方面。 Spring Cloud ...
在SpringCloud中,Ribbon与Eureka结合,可以自动从Eureka Server获取服务列表,然后在发起HTTP请求时,根据预设的策略(如轮询、随机等)选择一个服务实例进行调用,实现客户端的负载均衡。 3. **Feign声明式REST...
Spring Cloud 是一套基于 Spring Boot 实现的...3. **Spring Cloud Netflix Hystrix** - 断路器,用来处理服务间的熔断、容错、降级逻辑,确保当某个服务出现故障时不会影响整个系统。 4. **Spring Cloud Netflix Zuu
总的来说,"spring cloud微服务demo" 是一个演示如何使用 Spring Cloud 构建微服务应用的实例,包括服务注册与发现(Eureka Server 和 Eureka Client)、服务消费以及可能涉及的负载均衡。通过学习和实践这个 demo,...
SpringCloud微服务架构是当前企业级应用开发中的热门选择,它提供了一整套服务发现、配置管理、服务间通信以及负载均衡等工具,使得开发者能够快速构建复杂的分布式系统。在这个框架下,我们可以利用Eureka作为注册...
【Spring Cloud 微服务系统架构】是现代企业级应用程序开发的一种流行框架,它基于Spring Boot的便利性和Netflix OSS的一系列工具,为构建分布式系统提供了全面的解决方案。在微服务架构中,每个服务都是一个独立的...
SpringCloud微服务是Java开发领域中的一个热门框架,它提供了构建分布式系统所需的多种服务发现、配置管理、负载均衡、熔断机制等工具。本资源是一个关于SpringCloud微服务架构的实战博客源码,包含了多个核心组件的...