title: [Request processing failed; nested exception is java.lang.IllegalStateException: No instances available
body: <p>I have 3 services movie-infoservice, rating-data service and movie-catalog service. Movie-catalog-sevice calls the other 2 service and all the services are registered on the server.
  While executing movie-catalog service, I am receiving the below-mentioned error.</p>
  <pre><code>2020-06-27 17:08:54.331  INFO 13804 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
  2020-06-27 17:08:54.331  INFO 13804 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
  2020-06-27 17:08:54.357  INFO 13804 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 25 ms
  2020-06-27 17:08:55.356  INFO 13804 --- [nio-8081-exec-1] c.netflix.config.ChainedDynamicProperty  : Flipping property: rating-data-service.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
  2020-06-27 17:08:55.427  INFO 13804 --- [nio-8081-exec-1] c.n.u.concurrent.ShutdownEnabledTimer    : Shutdown hook installed for: NFLoadBalancer-PingTimer-rating-data-service
  2020-06-27 17:08:55.427  INFO 13804 --- [nio-8081-exec-1] c.netflix.loadbalancer.BaseLoadBalancer  : Client: rating-data-service instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=rating-data-service,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
  2020-06-27 17:08:55.438  INFO 13804 --- [nio-8081-exec-1] c.n.l.DynamicServerListLoadBalancer      : Using serverListUpdater PollingServerListUpdater
  2020-06-27 17:08:55.470  INFO 13804 --- [nio-8081-exec-1] c.netflix.config.ChainedDynamicProperty  : Flipping property: rating-data-service.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
  2020-06-27 17:08:55.473  INFO 13804 --- [nio-8081-exec-1] c.n.l.DynamicServerListLoadBalancer      : DynamicServerListLoadBalancer for client rating-data-service initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=rating-data-service,current list of Servers=[DESKTOP-LG8OP8I:8083],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone;    Instance count:1;   Active connections count: 0;    Circuit breaker tripped count: 0;   Active connections per server: 0.0;]
  },Server stats: [[Server:DESKTOP-LG8OP8I:8083;  Zone:defaultZone;   Total Requests:0;   Successive connection failure:0;    Total blackout seconds:0;   Last connection made:Thu Jan 01 05:30:00 IST 1970;  First connection made: Thu Jan 01 05:30:00 IST 1970;    Active Connections:0;   total failure count in last (1000) msecs:0; average resp time:0.0;  90 percentile resp time:0.0;    95 percentile resp time:0.0;    min resp time:0.0;  max resp time:0.0;  stddev resp time:0.0]
  ]}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@2d2d8589
  2020-06-27 17:08:56.276  INFO 13804 --- [nio-8081-exec-1] c.netflix.config.ChainedDynamicProperty  : Flipping property: movie-info-service.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
  2020-06-27 17:08:56.283  INFO 13804 --- [nio-8081-exec-1] c.n.u.concurrent.ShutdownEnabledTimer    : Shutdown hook installed for: NFLoadBalancer-PingTimer-movie-info-service
  2020-06-27 17:08:56.284  INFO 13804 --- [nio-8081-exec-1] c.netflix.loadbalancer.BaseLoadBalancer  : Client: movie-info-service instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=movie-info-service,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
  2020-06-27 17:08:56.289  INFO 13804 --- [nio-8081-exec-1] c.n.l.DynamicServerListLoadBalancer      : Using serverListUpdater PollingServerListUpdater
  2020-06-27 17:08:56.292  INFO 13804 --- [nio-8081-exec-1] c.n.l.DynamicServerListLoadBalancer      : DynamicServerListLoadBalancer for client movie-info-service initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=movie-info-service,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@4ed69386
  2020-06-27 17:08:56.328 ERROR 13804 --- [nio-8081-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: No instances available for movie-info-service] with root cause
  
  java.lang.IllegalStateException: No instances available for movie-info-service
      at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:105) ~[spring-cloud-netflix-ribbon-2.1.0.RELEASE.jar:2.1.0.RELEASE]
      at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:93) ~[spring-cloud-netflix-ribbon-2.1.0.RELEASE.jar:2.1.0.RELEASE]
      at org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor.intercept(LoadBalancerInterceptor.java:55) ~[spring-cloud-commons-2.1.0.RELEASE.jar:2.1.0.RELEASE]
      at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:93) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:77) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:739) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:674) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:315) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at com.example.moviecatalogservice.resource.MovieCatalogResource.lambda$getCatalog$0(MovieCatalogResource.java:76) ~[classes/:na]
      at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_172]
      at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) ~[na:1.8.0_172]
      at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[na:1.8.0_172]
      at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_172]
      at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_172]
      at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_172]
      at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_172]
      at com.example.moviecatalogservice.resource.MovieCatalogResource.getCatalog(MovieCatalogResource.java:80) ~[classes/:na]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_172]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_172]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_172]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_172]
      at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) ~[spring-webmvc-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) ~[spring-webmvc-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) ~[spring-webmvc-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.36.jar:9.0.36]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.7.RELEASE.jar:5.2.7.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) [tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) [tomcat-embed-core-9.0.36.jar:9.0.36]
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.36.jar:9.0.36]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_172]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_172]
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.36.jar:9.0.36]
      at java.lang.Thread.run(Thread.java:748) [na:1.8.0_172]
  
  2020-06-27 17:08:56.444  INFO 13804 --- [erListUpdater-0] c.netflix.config.ChainedDynamicProperty  : Flipping property: rating-data-service.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
  2020-06-27 17:13:44.585  INFO 13804 --- [trap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
  2020-06-27 17:18:44.589  INFO 13804 --- [trap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
  </code></pre>
  <p><strong>Server code:-</strong></p>
  <pre><code>@SpringBootApplication
  @EnableEurekaServer
  public class DiscoveryServerApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(DiscoveryServerApplication.class, args);
      }
  
  }
  </code></pre>
  <p><strong>Movie-CatalogService</strong></p>
  <p><strong>MovieCatalogServiceApplication</strong></p>
  <pre><code>@SpringBootApplication
  @EnableEurekaClient
  public class MovieCatalogServiceApplication {
      @Bean
      @LoadBalanced
      public RestTemplate getRestTemplate() {
      return new RestTemplate();
      }
  
  public static void main(String[] args) {
          SpringApplication.run(MovieCatalogServiceApplication.class, args);
      }
  
  }
  </code></pre>
  <p><strong>MovieCatalogResouce</strong></p>
  <pre><code>@RestController
      @RequestMapping(&quot;/catalog&quot;)
      public class MovieCatalogResource {
  @Autowired
      private RestTemplate restTemplate;
  
      @RequestMapping(&quot;/{userId}&quot;)
      public List&lt;CatalogItem&gt; getCatalog(@PathVariable(&quot;userId&quot;) String userId) {
  
          //get all rated movie IDs
          UserRating ratings = restTemplate.getForObject(&quot;http://rating-data-service/ratingdata/users/&quot; + userId, UserRating.class);
  
          //For each movie Id, call movie Info service and get details
          return ratings.getUserRating().stream().map(rating -&gt; {
              //For each movie Id, call movie Info service and get details
              Movie movie = restTemplate.getForObject(&quot;http://movie-info-service/movies/&quot; + rating.getMovieId(), Movie.class);
  
              //Put them all together
              return new CatalogItem(movie.getName(), &quot;Test&quot;, rating.getRating());
          }).collect(Collectors.toList());
      }
  }
  </code></pre>
  <p><strong>MovieInfoService</strong>
  <strong>MovieServiceApplication</strong></p>
  <pre><code>@SpringBootApplication
  @EnableEurekaClient
  public class MovieInfoServiceApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(MovieInfoServiceApplication.class, args);
      }
  
  }
  </code></pre>
  <p><strong>MovieResource</strong></p>
  <pre><code>@RestController
  @RequestMapping(&quot;/movies&quot;)
  public class MovieResource {
  
      @RequestMapping(&quot;/{movieId}&quot;)
      public Movie getMovieInfo(@PathVariable(&quot;movieId&quot;) String movie){
      return  new Movie(&quot;movieId&quot;, &quot;Test Name&quot;);
      }
  }
  </code></pre>
  <p><strong>Rating Service</strong></p>
  <p><strong>RatingDataServiceApplication</strong></p>
  <pre><code>@SpringBootApplication
  @EnableEurekaClient
  public class RatingDataServiceApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(RatingDataServiceApplication.class, args);
      }
  
  }
  </code></pre>
  <p><strong>RatingResource</strong></p>
  <pre><code>@RestController
  @RequestMapping(&quot;/{ratingdata}&quot;)
  public class RatingResource {
  
      @RequestMapping(&quot;/{movieId}&quot;)
      public Rating getRating(@PathVariable(&quot;movieId&quot;) String movieId) {
          return new Rating(4, movieId);
      }
  
      @RequestMapping(&quot;users/{userId}&quot;)
          public UserRating getUserRating(@PathVariable(&quot;userId&quot;) String userId) {
          List&lt;Rating&gt; ratings = Arrays.asList(
                  new Rating(4, &quot;1234&quot;),
                  new Rating(3, &quot;5678&quot;)
          );
  
          UserRating userRating = new UserRating();
          userRating.setUserRating(ratings);
          return userRating;
      }
  }
  
  </code></pre>
  <p><strong>application.properties for server</strong></p>
  <pre><code>server.port=8761 
  eureka.client.register-with-eureka=false 
  eureka.client.fetch-registry=false
  </code></pre>
  <p><strong>application.properties for clients</strong></p>
  <pre><code>spring.application.name = movie-catalog-service
  server.port = 8081 
  
  spring.application.name = movie-info-sevice 
  server.port = 8082 
  
  spring.application.name = rating-data-service 
  server.port = 8083
  </code></pre>