Open YLLQQ opened 4 years ago
i have the same problem, and my solution like this: https://blog.csdn.net/jiangxuexuanshuang/article/details/105815556 Hope to help you.
god bless me
@YLLQQ debug SeataLoadBalancerFeignClient
我也遇到了 去掉seata的相关依赖就可以 加上就不行
i have the same problem~
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<version>2.2.3.RELEASE</version>
</dependency>
为了使用seata,引入 这个依赖。发现服务启动时有提示找不到eureka-client属性.
2020-09-25 16:06:44,399 WARN [/] [main] com.netflix.discovery.internal.util.Archaius1Utils: Cannot find the properties specified : eureka-client. This may be okay if there are other environment specific properties or the configuration is installed with a different mechanism.
2020-09-25 16:06:44.400 WARN [ly-app-servicelocal,,,] 4568 --- [ main] c.n.d.internal.util.Archaius1Utils : Cannot find the properties specified : eureka-client. This may be okay if there are other environment specific properties or the configuration is installed with a different mechanism.
2020-09-25 16:06:44,400 WARN [/] [main] com.netflix.discovery.internal.util.Archaius1Utils: Cannot find the properties specified : eureka-client. This may be okay if there are other environment specific properties or the configuration is installed with a different mechanism.
2020-09-25 16:06:44.407 INFO [ly-app-servicelocal,,,] 4568 --- [ main] .p.EurekaConfigBasedInstanceInfoProvider : Setting initial instance status as: STARTING
2020-09-25 16:06:44,407 INFO [/] [main] com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider: Setting initial instance status as: STARTING
2020-09-25 16:06:44.409 WARN [ly-app-servicelocal,,,] 4568 --- [ main] c.n.d.internal.util.Archaius1Utils : Cannot find the properties specified : eureka-client. This may be okay if there are other environment specific properties or the configuration is installed with a different mechanism.
2020-09-25 16:06:44,409 WARN [/] [main] com.netflix.discovery.internal.util.Archaius1Utils: Cannot find the properties specified : eureka-client. This may be okay if there are other environment specific properties or the configuration is installed with a different mechanism.
2020-09-25 16:06:44.437 INFO [ly-app-servicelocal,,,] 4568 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
然后feign调用服务的时候,如果指定url就报找不到服务了,不指定url可以调服务器上的服务
@FeignClient(value = "ly-happly-servicelocal", url = "127.0.0.1:18011",path = "/happly")
2020-09-25 16:08:33.056 ERROR [ly-app-servicelocal,794c2f0ba8024105,794c2f0ba8024105,true] 4568 --- [io-18083-exec-1] c.l.c.c.global.GlobalExceptionHandler : com.netflix.client.ClientException: Load balancer does not have available server for client: 127.0.0.1
java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: 127.0.0.1
at org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:90)
at com.alibaba.cloud.seata.feign.SeataLoadBalancerFeignClient.execute(SeataLoadBalancerFeignClient.java:45)
at org.springframework.cloud.sleuth.instrument.web.client.feign.TraceLoadBalancerFeignClient.execute(TraceLoadBalancerFeignClient.java:75)
at org.springframework.cloud.sleuth.instrument.web.client.feign.TraceFeignAspect.executeTraceFeignClient(TraceFeignAspect.java:66)
at org.springframework.cloud.sleuth.instrument.web.client.feign.TraceFeignAspect.feignClientWasCalled(TraceFeignAspect.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691)
at com.alibaba.cloud.seata.feign.SeataLoadBalancerFeignClient$$EnhancerBySpringCGLIB$$7a35508d.execute(<generated>)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:119)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:89)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:100)
at com.sun.proxy.$Proxy167.getOperatorInfo(Unknown Source)
at com.ly.app.service.service.impl.OperatorServiceImpl.ownOperator(OperatorServiceImpl.java:196)
Load balancer does not have available server for client: 192.168.1.245
Type: bug report
what happened
The project has three modules: gateway, order and prodcut.
Every modules has started and registried in nacos, one request to order is forwarded by gateway, the order module has exception that does not have available server for client: 192.168.1.245.
The starting log shows that the order module update server list twice: one by application name, the other one by ip what cause the excption.
The order‘s starting log has these message:
2020-04-10 15:51:47.378 INFO [sc-unit-order-service,b81c3fff116c1a51,70851603a53071ad,false] 27315 --- [io-12014-exec-1] c.netflix.config.ChainedDynamicProperty : Flipping property: sc-unit-product-service.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647 2020-04-10 15:51:47.405 INFO [sc-unit-order-service,b81c3fff116c1a51,70851603a53071ad,false] 27315 --- [io-12014-exec-1] c.netflix.loadbalancer.BaseLoadBalancer : Client: sc-unit-product-service instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=sc-unit-product-service,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null 2020-04-10 15:51:47.414 INFO [sc-unit-order-service,b81c3fff116c1a51,70851603a53071ad,false] 27315 --- [io-12014-exec-1] c.n.l.DynamicServerListLoadBalancer : Using serverListUpdater PollingServerListUpdater 2020-04-10 15:51:47.436 INFO [sc-unit-order-service,b81c3fff116c1a51,70851603a53071ad,false] 27315 --- [io-12014-exec-1] c.netflix.config.ChainedDynamicProperty : Flipping property: sc-unit-product-service.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647 2020-04-10 15:51:47.440 INFO [sc-unit-order-service,b81c3fff116c1a51,70851603a53071ad,false] 27315 --- [io-12014-exec-1] c.n.l.DynamicServerListLoadBalancer : DynamicServerListLoadBalancer for client sc-unit-product-service initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=sc-unit-product-service,current list of Servers=[192.168.1.245:12015],Load balancer stats=Zone stats: {unknown=[Zone:unknown; Instance count:1; Active connections count: 0; Circuit breaker tripped count: 0; Active connections per server: 0.0;] },Server stats: [[Server:192.168.1.245:12015; Zone:UNKNOWN; Total Requests:0; Successive connection failure:0; Total blackout seconds:0; Last connection made:Thu Jan 01 08:00:00 CST 1970; First connection made: Thu Jan 01 08:00:00 CST 1970; Active Connections:0; total failure count in last (1000) msecs:0; average resp time:0.0; 90 percentile resp time:0.0; 95 percentile resp time:0.0; min resp time:0.0; max resp time:0.0; stddev resp time:0.0] ]}ServerList:com.alibaba.cloud.nacos.ribbon.NacosServerList@11eb14d7 2020-04-10 15:51:47.598 INFO [sc-unit-order-service,b81c3fff116c1a51,70851603a53071ad,false] 27315 --- [io-12014-exec-1] c.netflix.config.ChainedDynamicProperty : Flipping property: 192.168.1.245.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647 2020-04-10 15:51:47.601 INFO [sc-unit-order-service,b81c3fff116c1a51,70851603a53071ad,false] 27315 --- [io-12014-exec-1] c.netflix.loadbalancer.BaseLoadBalancer : Client: 192.168.1.245 instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=192.168.1.245,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null 2020-04-10 15:51:47.604 INFO [sc-unit-order-service,b81c3fff116c1a51,70851603a53071ad,false] 27315 --- [io-12014-exec-1] c.n.l.DynamicServerListLoadBalancer : Using serverListUpdater PollingServerListUpdater 2020-04-10 15:51:47.611 INFO [sc-unit-order-service,b81c3fff116c1a51,70851603a53071ad,false] 27315 --- [io-12014-exec-1] c.n.l.DynamicServerListLoadBalancer : DynamicServerListLoadBalancer for client 192.168.1.245 initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=192.168.1.245,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:com.alibaba.cloud.nacos.ribbon.NacosServerList@51512427 2020-04-10 15:51:47.719 ERROR [sc-unit-order-service,b81c3fff116c1a51,70851603a53071ad,false] 27315 --- [io-12014-exec-1] o.s.c.s.i.web.ExceptionLoggingFilter : Uncaught exception thrown
Caused by: java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: 192.168.1.245
development environment