Zuul实现WeightedResponseTimeRule错误 - 客户端null的VIP地址为空

时间:2017-02-13 14:23:50

标签: spring spring-boot netflix-zuul spring-cloud-netflix

我正在遇到这个VIP地址null white为我的Zuul网关实现weightedResponseTimeRule。

我做得对吗?实现一个将实现weightedRule的配置。 我想将我的请求路由到我的2个或更多实例。

Error creating bean with name 'ribbonServerList' defined in org.springframework.cloud.netflix.ribbon.eureka.EurekaRibbonClientConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.loadbalancer.ServerList]: Factory method 'ribbonServerList' threw exception; nested exception is java.lang.NullPointerException: VIP address for client null is null

目前我的功能区配置

    @Configuration
    public class GatewayRibbonConfiguration {

    @Bean
    public IClientConfig ribbonClientConfig(){
        return new DefaultClientConfigImpl();
    }

    @Bean
    public IPing ribbonPing(IClientConfig config) {
        return new PingUrl();
    }

    @Bean
    public IRule ribbonRule(IClientConfig config) {
        return new WeightedResponseTimeRule();
    }
}

应用

    @SpringBootApplication
    @EnableDiscoveryClient
    @EnableZuulProxy
    public class GatewayApplication {

        public static void main(String[] args) {
            SpringApplication.run(GatewayApplication.class, args);
        }

        @Bean
        public Prefilter prefilter(){
            return new Prefilter();
        }
    }

bootstrap.yml

    spring:
      application:
        name: gateway

    eureka:
      client:
        serviceUrl:
          defaultZone: http://localhost:8761/eureka/

我的属性

    server:
      port: 8080


    hystrix:
      command:
        default:
          execution:
            isolation:
              thread:
                timeoutInMilliseconds: 20000

    ribbon:
      ReadTimeout: 20000
      ConnectTimeout: 20000

    zuul:
      prefix: /api
      ignoredServices: '*'
      host:
        connect-timeout-millis: 20000
        socket-timeout-millis: 20000
      routes:
        kicks-service:
          path: /kicks/**
          serviceId: kicks-service
          stripPrefix: false
          sensitiveHeaders:
        kicks-inventory:
          path: /inventory/**
          serviceId: kicks-inventory
          stripPrefix: false
          sensitiveHeaders: 

0 个答案:

没有答案