Feign reports an error when calling the service: Load balancer does not have available server for client:xxx

1. Talk about the bugs encountered: (Episode 30 of Dark Horse Programmer springcloud, based on Feign remote calling)

3 services start normally:

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

 Server error log: (orderservice wants to call userservice but cannot find userservice)

View nacos registration center:

userservice in public environment

orderservice in dev environment:

To implement orderservice and call userservice through feign, it must be in the same namespace:

Add the following code in bootstrap:

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

Note that this namespace was set previously:

 

Restart the service and take a look:

There is no service in the public environment

orderservice and userservice are placed in the dev environment 

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

The result is shown in the figure: 

Guess you like

Origin blog.csdn.net/qq_56444564/article/details/135019271
Recommended