我正在使用 Spring Cloud 版本 1.0.0.RC1。收到错误“无法找到服务的 ILoadBalancer”。
任何想法..是遗漏的。功能区没有使用默认负载平衡器。
##########application.yml##############
spring:
cloud:
client:
serviceIds:
- records
records:
ribbon:
listOfClients: http://VISERVER09:8761/eureka-server-0.0.1-SNAPSHOT/eureka,http://VISERVER08:8761/eureka-server-0.0.1-SNAPSHOT/eureka
################代码使用服务#############
String url = "http://records/ServiceB-0.0.1-SNAPSHOT/records/{record}";
restTemplate.getForObject(url, String.class, "1234");
##########日志输出###############
--- BaseLoadBalancer: Client:records instantiated a LoadBalancer:DynamicServerListLoadBalancer:{NFLoadBalancer:name=records,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
--- ChainedDynamicProperty: Flipping property: records.ribbon.ActiveConnectionsLimitto use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
--- DynamicServerListLoadBalancer: DynamicServerListLoadBalancer for client records initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=records,current list of Servers=[VISERVER08:8181, VISERVER09:8181],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone; Instance count:2; Active connections count: 0; Circuit breaker tripped count: 0; Active connections per server: 0.0;]
},Server stats: [[Server:VISERVER09:8181; Zone:defaultZone; Total Requests:0; Successive connection failure:0; Total blackout
seconds:0; Last connection made:Thu Jan 01 01:00:00 GMT 1970; First connection made: Thu Jan 01 01:00:00 GMT 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]
, [Server:VISERVER08:8181; Zone:defaultZone; Total Requests:0; Successive connection failure:0; Total blackout seconds:0;
Last connection made:Thu Jan 01 01:00:00 GMT 1970; First connection made: Thu Jan 01 01:00:00 GMT 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 re
sp time:0.0; stddev resp time:0.0]
]}ServerList:DiscoveryEnabledNIWSServerList:; clientName:records; Effective vipAddresses:records; isSecure:false; datacenter:null
--- ConnectionPoolCleaner: Initializing ConnectionPoolCleaner for NFHttpClient:VISERVER08
--- ConnectionPoolCleaner: Initializing ConnectionPoolCleaner for NFHttpClient:VISERVER08
--- [dispatcherServlet]: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Unable to locate ILoadBalancer for service: VISERVER08] with root cause
**java.lang.IllegalStateException: Unable to locate ILoadBalancer for service: VISERVER08**
at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.getServer(RibbonLoadBalancerClient.java:77)
at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:45)
at org.springframework.cloud.netflix.ribbon.RibbonInterceptor.intercept(RibbonInterceptor.java:30)
at org.springframework.http.client.InterceptingClientHttpRequest$RequestExecution.execute(InterceptingClientHttpRequest.java:84)
at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:69)
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)