谷粒商城项目 gulimall-order服务:集成seata和zipkin 报错Load balancer does not have available server for client
若需要同时使用,在启动类加入排除@SpringBootApplication(exclude = {SeataFeignClientAutoConfiguration.class})若不需要对 Feign 链路追踪,可以通过 Spring Cloud Sleuth 提供的属性 spring.sleuth.feign.enabled=false 来使其关闭。**谷粒商城项目 gulimall-ord
·
**谷粒商城项目 gulimall-order服务:集成seata和zipkin 报错如下:**Load balancer does not have available server for client: 192.168.248.1
2024-03-10 16:48:27.430 ERROR [gulimall-order,,,] 32208 --- [nio-9010-exec-9] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.util.concurrent.ExecutionException: java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: 192.168.82.184] with root cause
com.netflix.client.ClientException: Load balancer does not have available server for client: 192.168.82.184
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]
解决方案:
-
若不需要对 Feign 链路追踪,可以通过 Spring Cloud Sleuth 提供的属性 spring.sleuth.feign.enabled=false 来使其关闭。
-
若需要同时使用,在启动类加入排除@SpringBootApplication(exclude = {SeataFeignClientAutoConfiguration.class})
再配置 Feign 的拦截器
@Component
@ConditionalOnClass({RequestInterceptor.class, GlobalTransactional.class})
public class SetSeataInterceptor implements RequestInterceptor {
@Override
public void apply(RequestTemplate template) {
String currentXid = RootContext.getXID();
if (!StringUtils.isEmpty(currentXid)) {
template.header(RootContext.KEY_XID, currentXid);
}
}
}
参考链接:
https://seata.apache.org/zh-cn/docs/overview/faq/

https://github.com/apache/incubator-seata/issues/2544
更多推荐
所有评论(0)