问题描述:openfeign远程调用服务提示"feign.FeignException$ServiceUnavailable: [503] during [GET] to ×××"。
解决措施:
步骤1:远程服务调用必须使用负载均衡组件,低版本的feign组件内嵌了ribbon,高版本没ribbon,需手动添加spring-cloud-starter-loadbalancer依赖,
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
<version>3.1.6</version>
</dependency>
如果步骤1还不可以,见步骤2
步骤2:我启动的两个服务的命名空间不一致,换成同一个命名空间就可以成功了
难道说nacos中只有同命名空间下的服务才能相互调用???
Caused by:
feign
.
Feign
Exception
$
Service
U
nav
ai
labl
e: [
503
] during [GET] to [http://sundial-user-provider/user/getByLoginName/%E6%98%8E] [IUserFacede#getByLoginName(String)]: [Load balancer does not cont
ai
n an instance for the
service
sundial-user-provider]
open
Feign
配合nacos服务发现进行微服务调用返回
503
service
u
nav
ai
labl
e
出现问题的远程接口代码
@
Feign
Client("target
Service
")
public interface
Feign
Service
{
@GetMapping("/xxxx/xxxx/xxxx/list")
public R call
Service
();
返回的错误信息大概是
feign
.
Feign
Exception
$
Service
U
nav
ai
labl
e: [
503
S
feign
.
Feign
Exception
$
Service
U
nav
ai
labl
e: [
503
Service
U
nav
ai
labl
e] during GET
@
Feign
Client(name = "****") 和 该微服务名字不一样,调用api 会报
feign
.
Feign
Exception
$
Service
U
nav
ai
labl
e: [
503
Service
U
nav
ai
labl
e] during GET …
解决方法: name = "user-server" 的名字要和 application.yaml中
spring
: application: name: user-server 一样
2、坑..
Binary data
2020-11-11 19:47:07.894 ERROR c.n.c.c.r.e.Global
Exception
Handler:72 - errorMsg=Read timed out executing GET http://XXXXXXX,innerCode=5000,
exception
={}
feign
.Retryable
Exception
: Read timed out executing GET http:// XXXXXXXX
at
feign
.F
在项目中用Open
Feign
做生产者调用,结果消费者调用失败,并报出如下错误:
XXXX 14:11:59.302 ERROR 19596 --- [io-10000-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.
service
() for servlet [dispatcherServlet] in context with path [] threw
exception
[Request processing f
ai
led; nes