转载来源: https://blog.csdn.net/FansUnion/article/details/90635479
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: crm-service
at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:468)
迁移B项目到A项目,最后发现2个项目Spring*版本不一致,猜测很可能就是这个原因导致的。
因为,其它能想到的办法都试过了。
-
<parent>
-
<groupId>org.springframework.boot
</groupId>
-
<artifactId>spring-boot-starter-parent
</artifactId>
-
<version>1.5.13.RELEASE
</version>
-
<relativePath/>
<!-- lookup parent from repository -->
-
</parent>
-
<dependencyManagement>
-
<dependencies>
-
<dependency>
-
<groupId>org.springframework.cloud
</groupId>
-
<artifactId>spring-cloud-dependencies
</artifactId>
-
<version>Edgware.SR4
</version>
-
<type>pom
</type>
-
<scope>import
</scope>
-
</dependency>
-
</dependencies>
-
</dependencyManagement>
"Load balancer does not have available server for client"出现这个问题,可能还有其他原因,网上的解决办法都尝试过了。
所以,最终只能怀疑是版本问题了。
SpringCloud SpringBoot新手上路。
在排查过程中,发现一个相关小问题。
@SpringCloudApplication里面嵌套了@SpringBootApplication。
如果需要自定义扫描包路径,放在@SpringCloudApplication的前面。要不然使用的是“@SpringCloudApplication里面的@SpringBootApplication”
@SpringBootApplication(scanBasePackages="com.b")
@SpringCloudApplication
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@SpringBootApplication
@EnableDiscoveryClient
@EnableCircuitBreaker
public @interface SpringCloudApplication {
}
自定义路径,是特例,一般也不会遇到这个问题。