spring-cloud / spring-cloud-gateway

An API Gateway built on Spring Framework and Spring Boot providing routing and more.
http://cloud.spring.io
Apache License 2.0
4.51k stars 3.31k forks source link

No servers available when routing #1695

Closed pgm-rookie closed 3 years ago

pgm-rookie commented 4 years ago

My route definition code is like below:

@Configuration
public class RouteConfiguration {`
@Bean`
public RouteLocator routeLocator(RouteLocatorBuilder builder){
    return builder.routes()
             .route("user-management", r -> r
                    .path("/user-management/**")
                    .filters(f -> f
                                    .hystrix(h->  h.setName("fallbackCmd").setFallbackUri("forward:/fallback"))                             
                    )
                    .uri("lb://user-management"))
            .build();
    }
}

I start eureka server,config center,gateway in order,and then i start user management service. Requests can not route to user management service,

o.s.c.l.core.RoundRobinLoadBalancer      : No servers available for service: USER-MANAGEMENT

This log will appear in gateway log file,but if i restart gateway ,it will be OK. I remembered this problem does not appear in SpringCloud version:Finchley, i can start gateway before other downstream services or after.

How i can relsove this problem, THKS!

spencergibb commented 4 years ago

How long did you wait?

pgm-rookie commented 4 years ago

until I restart gateway service or requests can not route to downstream service , if I change property "spring.cloud.netflix.ribbon=true" to ues ribbon instead of spring cloud loadbalance, there's no problem.

pgm-rookie commented 4 years ago

How long did you wait?

until I restart gateway service or requests can not route to downstream service , if I change property "spring.cloud.netflix.ribbon=true" to ues ribbon instead of spring cloud loadbalance, there's no problem.

pgm-rookie commented 4 years ago

It may have something to do with spring cloud loadbalance.

cleverpig commented 3 years ago

Mark! I met the same

spencergibb commented 3 years ago

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.

spring-cloud-issues commented 3 years ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-cloud-issues commented 3 years ago

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

kisevu commented 1 year ago

I have the same problem, It's sad that up to now, the spring cloud team can't provide a walkaround. I try to re-route to the actual service but not fruitful. The gateway logs keep saying, No servers availble for service customer

xTreeRoot commented 1 year ago

md,+1,网关日志一直说,服务客户没有可用的服务器

kisevu commented 1 year ago

@xTreeRoot We can't get you. Please write in English kindly

Add0z commented 8 months ago

@kisevu did you find solution for it? im have no idea what is causing that.

kisevu commented 8 months ago

Earlier on, it was a dependency issue and issues about the spring boot version. Try and use spring boot 3.2.1 or 3.1.7 with java 17 or higher and this can mitigate the issue. I nolonger face the same issue. Also try and use tomcat 9 >