1

I have the following very simple feign client:

@FeignClient(name = "user-client", fallbackFactory = UserClientFallbackFactory.class, configuration = MyFeignConfig.class)
public interface UserServiceClient {

    @GetMapping(value = "/users", headers = {"Content-Type: application/json"})
    List<Namespace> getIdentities(URI baseUrl);
}

With the following application.yml

feign:
  hystrix:
    enabled: true

hystrix:
    command:
      default:
        execution:
          timeout.enabled: false
          isolation.semaphore.maxConcurrentRequests: 100

When I invoke the client, I dynamically generate the URL at runtime:

client.getIdentities(new URI("http://my-user-service.com"));

But this throws the error:

com.netflix.client.ClientException: Load balancer does not have available server for client: my-user-service.com

If I manually specify the URL in the client itself(but still pass in a built URI object), the error goes away:

@FeignClient(name = "user-client", url = "http://my-user-service.com", fallbackFactory = UserClientFallbackFactory.class, configuration = MyFeignConfig.class)

I am using

spring-cloud-starter-openfeign
spring-cloud-starter-netflix-hystrix

With

springBootVersion = '2.1.8.RELEASE'
springCloudVersion = 'Greenwich.SR1'

Why is this happening? Why do I need to specify the hard-coded URL if I am specifying the URL at runtime ? And what's this load-balancer ? I haven't configured any of that

Pepria
  • 394
  • 1
  • 8
  • 22
  • 1
    The loadbalancer you mentioned is probably Ribbon. And all those, Feign, Hystrix, Ribbon and Eureka are tightly coupled together and require precision when used. Try checking this question: https://stackoverflow.com/questions/41401009/load-balancer-does-not-have-available-server-for-client – Random Guy Apr 02 '20 at 21:49

0 Answers0