SpringBoot和SpringCloud版本问题:Load balancer does not have available server for client

转载来源: 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*版本不一致,猜测很可能就是这个原因导致的。

    因为,其它能想到的办法都试过了。

 


  
  
  1.   <parent>
  2.         <groupId>org.springframework.boot </groupId>
  3.         <artifactId>spring-boot-starter-parent </artifactId>
  4.         <version>1.5.13.RELEASE </version>
  5.         <relativePath/> <!-- lookup parent from repository -->
  6.     </parent>    
  7.   <dependencyManagement>
  8.         <dependencies>
  9.             <dependency>
  10.                 <groupId>org.springframework.cloud </groupId>
  11.                 <artifactId>spring-cloud-dependencies </artifactId>
  12.                 <version>Edgware.SR4 </version>
  13.                 <type>pom </type>
  14.                 <scope>import </scope>
  15.             </dependency>
  16.         </dependencies>
  17.     </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 {
}

自定义路径,是特例,一般也不会遇到这个问题。

发布了59 篇原创文章 · 获赞 30 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_33249725/article/details/90642813