首页 > 解决方案 > “com.netflix.client.ClientException:负载均衡器没有可用于客户端的服务器:外汇服务”

问题描述

我是微服务的新手,只是想创建两个微服务并将它们注册到尤里卡。我收到以下异常:

"com.netflix.client.ClientException: Load balancer does not have available server for client: forex-service".  Below is my configuration.

尤里卡命名服务器类:

@SpringBootApplication @EnableEurekaServer public class MicroserviceEurekaNamingServerApplication {}

应用程序属性

spring.application.name=netflix-eureka-naming-server server.port=8761 eureka.client.register-with-eureka=false eureka.client.fetch-registry=false

外汇服务等级:

@SpringBootApplication @EnableDiscoveryClient @EnableEurekaClient public class Forex2Microservice2Application {}

应用程序属性

spring.application.name=forex-service spring.jpa.show-sql=true spring.h2.console.enabled=true eureka.client.service-url.default-zone=http://localhost:8761/eureka

货币服务类:

@SpringBootApplication @EnableFeignClients @EnableDiscoveryClient @EnableEurekaClient public class SpringBootMicroserviceCurrencyConversionApplication {}

应用程序属性

spring.application.name=currency-conversion-service server.port=8100 eureka.client.service-url.default-zone=http://localhost:8761/eureka

假装客户端

@FeignClient(name = "forex-service") @RibbonClient(name = "forex-service") public interface CurrencyExchangeServiceProxy {}

提前致谢。

标签: spring-bootmicroservicesnetflix-eurekanetflix-ribbon

解决方案


推荐阅读