本文目录
一、问题描述
二、错误原因
三、解决方案
3.1 方案1
3.2 方案2
一、问题描述
报错信息如下
Caused by: : Load balancer does not have available server for client: basic-iot-config
at (:483)
at $(:184)
at $(:180)
at (:10211)
at (:94)
at (:42)
at (:48)
at (:30)
at (:48)
at (:30)
at (:10307)
at (:10274)
at (:445)
at (:342)
at (:117)
at (:63)
... 33 common frames omitted
二、错误原因
在 SpringCloud 项目,会经常用一个 服务A 中调用另一个 微服务B,明明启动了 微服务B,但是却仍然报错
: Load balancer does not have available server for client: xxx
这时候,造成这种情况的原因基本上都是 两个服务注册到注册中心的端口不一样或者是注册到注册中心的服务名字不一致。
三、解决方案
3.1 方案1
方案1解决了此问题:
将两个服务(注册的服务和消费的服务)的名字改为一致即可,或者访问访问的URL改成一样的。
public class SystemConstant {
/**
* 应用名
*/
public static final String APPLICATION_NAME = "back-operation-service-123";
}
spring:
application:
name: back-operation-service-123
system: operation
3.2 方案2
在 配置文件中添加
: true
完结!