0

I am building microservices in my local machine. One client app is based on netflix-ribbon and netflix-eureka. I am getting the below error in logs.

com.netflix.client.ClientException: Load balancer does not have available server for client: currency-exchange-service at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:483) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0] at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0] at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8]

To resolve this I had to remove the below dependency, after which the service was working fine.

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.4.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.sudip.mircoservices</groupId>
<artifactId>currency-calculation-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>currency-calculation-service</name>
<description>Demo project for Spring Boot</description>

<properties>
    <java.version>1.8</java.version>
    <spring-cloud.version>Greenwich.SR1</spring-cloud.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-config</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-openfeign</artifactId>
        <version>2.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
        <version>2.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        <version>2.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

I want to register this (consider service A) as service in Eureka as well as have load balancing in the service A service which will call one instance (service B) out of 3 instances running.

CodeRider
  • 564
  • 4
  • 15
  • Can you show all of your dependencies? – spencergibb Apr 23 '19 at 20:23
  • I have updated the origional question with all the dependencies – CodeRider Apr 24 '19 at 11:41
  • After commenting spring-cloud-starter-netflix-eureka-client, the service works perfectly fine. – CodeRider Apr 24 '19 at 12:10
  • You still haven't shown all your dependencies since I don't know what version of boot you are using. – spencergibb Apr 25 '19 at 07:55
  • Don't pass versions of cloud artifacts manually. We suggest using the dependencyManagement plugin and Release Trains. Go to https://start.spring.io/ to generate a correct pom. Also, SpringBoot 2.0.x (compatible with Spring Cloud 2.0.x) already hit EOL. Use 2.1.x versions for both boot and cloud artifacts. – OlgaMaciaszek Apr 25 '19 at 11:41
  • I was suspecting the same. But I wanted to know the root cause for this, which is still unknown. – CodeRider Apr 26 '19 at 08:10
  • @spencergibb - I have update the pom with all dependencies. Sorry for taking these many days, was occupied with some other works. – CodeRider May 01 '19 at 15:21

0 Answers0