title: Spring Cloud service Look up error: Load balancer does not have available server for client
body: <p>I've been playing with a Spring Cloud app consisting of a config server, a discovery server (Eureka) and a Feign client with Ribbon (internally used by Feign). I've 2 services, a <code>movie-service</code> and a <code>daily-update-service</code>. The intent is to provide a daily update of popular movies, news and weather in one place.
  Problem I'm having is that the <code>movie-service</code> Feign client is not able to find it from <code>daily-update-service</code>. It errors out with the following:</p>
  
  <pre><code>Caused by: java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: movie-service
  daily_update_service_1 |    at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:59) ~[spring-cloud-netflix-core-1.1.0.M4.jar:1.1.0.M4]
  daily_update_service_1 |    at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:95) ~[feign-core-8.12.1.jar:8.12.1]
  daily_update_service_1 |    at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:74) ~[feign-core-8.12.1.jar:8.12.1]
  daily_update_service_1 |    at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:54) ~[feign-hystrix-8.12.1.jar:8.12.1]
  daily_update_service_1 |    at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:294) ~[hystrix-core-1.4.21.jar:1.4.21]
  daily_update_service_1 |    ... 21 common frames omitted
  daily_update_service_1 | Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: movie-service
  daily_update_service_1 |    at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:468) ~[ribbon-loadbalancer-2.1.0.jar:2.1.0]
  daily_update_service_1 |    at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184) ~[ribbon-loadbalancer-2.1.0.jar:2.1.0]
  daily_update_service_1 |    at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180) ~[ribbon-loadbalancer-2.1.0.jar:2.1.0]
  </code></pre>
  
  <p>My debugging so far shows that the <a href="http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-ribbon" rel="nofollow">DomainExtractingServerList</a> is trying to do a look up by VIP, which's <code>movie-service</code> and coming up with no servers. The services are registered in Eureka and I can see them on the Eureka dashboard.</p>
  
  <p>I'm not sure what pieces of the code are relevant so I'm posting a link to the <a href="https://github.com/abhijitsarkar/java-ee/tree/master/daily-update-microservices" rel="nofollow">Github project</a>. Assuming you've Docker and Docker Compose installed, the easiest way to get it up and running is to clone the project and then follow the following instructions. These instructions are for a Mac/Linux OS, adapt them if necessary to Windows. I'll provide specific code snippets if someone wants to see it here instead of looking in the code.</p>
  
  <ol>
  <li><code>cd daily-update-microservices</code>.</li>
  <li>Replace all occurences of my docker host IP with yours. You can use this command: <code>grep -rl '192.168.99.107' . | xargs perl -pi -e "s/192\.168\.99\.107/$(echo $DOCKER_HOST | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}')/"</code></li>
  <li>Run <code>./gradlew clean buildDockerImage</code></li>
  <li>Run <code>docker-compose -f daily-update-service/docker-compose.yml up</code>.</li>
  <li>Once the services come up, do a <code>curl -v http://$(echo $DOCKER_HOST | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}'):10000/dailyupdate/movies/popular</code></li>
  </ol>