Feign调用服务报错:Load balancer does not have available server for client:xxx

1.说一下遇到的bug:,(黑马程序员springcloud的第30集,基于Feign远程调用)

3个服务正常启动:

Feign调用服务报错:Load balancer does not have available server for client:xxx_第1张图片

访问http://localhost:8080/order/101

Feign调用服务报错:Load balancer does not have available server for client:xxx_第2张图片 服务器报错日志:(orderservice想调用userservice结果找不到userservice)

Feign调用服务报错:Load balancer does not have available server for client:xxx_第3张图片

查看nacos注册中心:

userservice在public环境中

Feign调用服务报错:Load balancer does not have available server for client:xxx_第4张图片

orderservice在dev环境中:

Feign调用服务报错:Load balancer does not have available server for client:xxx_第5张图片

要实现orderservice通过feign调用userservice得在同一个命名空间中:

Feign调用服务报错:Load balancer does not have available server for client:xxx_第6张图片

在bootstrap中添加如下代码:

      discovery:
        namespace: a4d6edd5-0a49-4b4f-8953-4fb443118a2c

注意这个命名空间是之前设置的:

Feign调用服务报错:Load balancer does not have available server for client:xxx_第7张图片 

重新启动服务看一下:

public环境下没有服务了

Feign调用服务报错:Load balancer does not have available server for client:xxx_第8张图片

orderservice和userservice放在了dev环境下 

Feign调用服务报错:Load balancer does not have available server for client:xxx_第9张图片

访问http://localhost:8080/order/107 

结果如图所示: 

Feign调用服务报错:Load balancer does not have available server for client:xxx_第10张图片

你可能感兴趣的:(其他,spring,boot,后端,java)