Spring Cloud Gateway Unable to find instance for xxx

See original GitHub issue
2021-03-28 10:43:17.256 DEBUG 8747 --- [ctor-http-nio-5] r.n.http.server.HttpServerOperations     : [id:62bc3fa5, L:/127.0.0.1:8080 - R:/127.0.0.1:59235] New http connection, requesting read
2021-03-28 10:43:17.256 DEBUG 8747 --- [ctor-http-nio-5] reactor.netty.transport.TransportConfig  : [id:62bc3fa5, L:/127.0.0.1:8080 - R:/127.0.0.1:59235] Initialized pipeline DefaultChannelPipeline{(reactor.left.httpCodec = io.netty.handler.codec.http.HttpServerCodec), (reactor.left.httpTrafficHandler = reactor.netty.http.server.HttpTrafficHandler), (reactor.right.reactiveBridge = reactor.netty.channel.ChannelOperationsHandler)}
2021-03-28 10:43:17.264 DEBUG 8747 --- [ctor-http-nio-5] r.n.http.server.HttpServerOperations     : [id:62bc3fa5, L:/127.0.0.1:8080 - R:/127.0.0.1:59235] Increasing pending responses, now 1
2021-03-28 10:43:17.264 DEBUG 8747 --- [ctor-http-nio-5] reactor.netty.http.server.HttpServer     : [id:62bc3fa5-1, L:/127.0.0.1:8080 - R:/127.0.0.1:59235] Handler is being applied: org.springframework.http.server.reactive.ReactorHttpHandlerAdapter@1358870c
2021-03-28 10:43:17.264 DEBUG 8747 --- [ctor-http-nio-5] o.s.w.s.adapter.HttpWebHandlerAdapter    : [62bc3fa5-1, L:/127.0.0.1:8080 - R:/127.0.0.1:59235] HTTP POST "/system/oauth/token?username=aaa&secretCode=aaa&autoLogin=true&type=account&password=quiet&grant_type=password"
2021-03-28 10:43:17.265 DEBUG 8747 --- [ctor-http-nio-5] o.s.c.g.h.RoutePredicateHandlerMapping   : Route matched: system
2021-03-28 10:43:17.265 DEBUG 8747 --- [ctor-http-nio-5] o.s.c.g.h.RoutePredicateHandlerMapping   : Mapping [Exchange: POST http://127.0.0.1:8080/system/oauth/token?username=aaa&secretCode=aaa&autoLogin=true&type=account&password=quiet&grant_type=password] to Route{id='system', uri=lb://quiet-system, order=0, predicate=Paths: [/system/**], match trailing slash: true, gatewayFilters=[], metadata={}}
2021-03-28 10:43:17.265 DEBUG 8747 --- [ctor-http-nio-5] o.s.c.g.h.RoutePredicateHandlerMapping   : [62bc3fa5-1, L:/127.0.0.1:8080 - R:/127.0.0.1:59235] Mapped to org.springframework.cloud.gateway.handler.FilteringWebHandler@e9be574
2021-03-28 10:43:17.265 DEBUG 8747 --- [ctor-http-nio-5] o.s.c.g.handler.FilteringWebHandler      : Sorted gatewayFilterFactories: [[GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RemoveCachedBodyFilter@1150d471}, order = -2147483648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.AdaptCachedBodyGlobalFilter@2da99821}, order = -2147482648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyWriteResponseFilter@70029d2d}, order = -1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardPathFilter@14168e1}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.GatewayMetricsFilter@1e225820}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter@709f0202}, order = 10000], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.config.GatewayNoLoadBalancerClientAutoConfiguration$NoLoadBalancerClientFilter@8aeab9e}, order = 10150], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.WebsocketRoutingFilter@16a5c7e4}, order = 2147483646], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyRoutingFilter@3c952a33}, order = 2147483647], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardRoutingFilter@654e6a90}, order = 2147483647]]
2021-03-28 10:43:17.265 DEBUG 8747 --- [ctor-http-nio-5] a.w.r.e.AbstractErrorWebExceptionHandler : [62bc3fa5-1, L:/127.0.0.1:8080 - R:/127.0.0.1:59235] Resolved [NotFoundException: 503 SERVICE_UNAVAILABLE "Unable to find instance for quiet-system"] for HTTP POST /system/oauth/token
2021-03-28 10:43:17.266 DEBUG 8747 --- [ctor-http-nio-5] o.s.http.codec.json.Jackson2JsonEncoder  : [62bc3fa5-1, L:/127.0.0.1:8080 - R:/127.0.0.1:59235] Encoding [{timestamp=Sun Mar 28 10:43:17 CST 2021, path=/system/oauth/token, status=503, error=Service Unavail (truncated)...]
2021-03-28 10:43:17.266 DEBUG 8747 --- [ctor-http-nio-5] r.n.http.server.HttpServerOperations     : [id:62bc3fa5-1, L:/127.0.0.1:8080 - R:/127.0.0.1:59235] Detected non persistent http connection, preparing to close
2021-03-28 10:43:17.266 DEBUG 8747 --- [ctor-http-nio-5] r.n.http.server.HttpServerOperations     : [id:62bc3fa5-1, L:/127.0.0.1:8080 - R:/127.0.0.1:59235] Last HTTP packet was sent, terminating the channel
2021-03-28 10:43:17.267 DEBUG 8747 --- [ctor-http-nio-5] o.s.w.s.adapter.HttpWebHandlerAdapter    : [62bc3fa5-1, L:/127.0.0.1:8080 - R:/127.0.0.1:59235] Completed 503 SERVICE_UNAVAILABLE

This is gateway config:

spring:
  application:
    name: quiet-gateway
  cloud:
    nacos:
      discovery:
        server-addr: 127.0.0.1:8848
    gateway:
      routes:
        - id: system
          uri: lb://quiet-system
          predicates:
            - Path=/system/**
          filters:
            - StripPrefix=1

This is nacos states:

image

version details: image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
guerlabcommented, Mar 31, 2021

2020.0.x need add this dependency <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-loadbalancer</artifactId> </dependency>

0reactions
guerlabcommented, Apr 1, 2021

2020.0.x need add this dependency <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-loadbalancer</artifactId> </dependency>

非常感谢。我验证过,加上了这个依赖就成功运行了。

image

please close this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem "Unable to find instance for XXX" occurs when using ...
When integrating spring-cloud-gateway with nacos, we use nacos as service discovery & config center, define the gateway routes for load-balance.
Read more >
Sping Cloud Gateway Unable to find instance for - CSDN博客
1、spring.application.name 中不要使用下划线,只能是字母数字和横杠. 对下划线很多位置是不支持的(可以形成编码规范,name不要用下划线)。
Read more >
spring-cloud/spring-cloud - Gitter
Hi All, i have the following chain of services handling requests for me [client] -> [apache reverse proxy (with DNS address)] -> [spring...
Read more >
Spring Gateway deployment on external tomcat - Stack Overflow
I can see it in the tomcat manager as deployed. Here is the pom.xml of the gateway : <project xmlns="http://maven.apache.
Read more >
Spring Cloud
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found