ZuulException:Zuul-Eureka的前向错误

时间:2016-10-13 23:54:36

标签: spring spring-cloud spring-cloud-netflix

我在与Zuul和Eureka路由时遇到ZuulException: forward error

在第一分钟内没有发生错误,但在1或2分钟后我得到这个奇怪的错误。

我使用 spring boot 1.4 spring cloud Camden

如果您想重现错误或查看我的项目:https://github.com/Seb69/Spring-demo-ZuulException/tree/master

Eureka配置:

server:
    port: 9999

spring:
    application:
        name: eureka-server
eureka:
   instance:
     hostname: localhost
   client:
     registerWithEureka: false
     fetchRegistry: false
     serviceUrl:
       defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

服务网关配置(Zuul):

server:
    port: 1111
spring:
    application:
        name: service-gateway

# ZUUL (Load balancing)
zuul:
    ignoredServices: '*'
    routes:
        service-server:
            stripPrefix: true
            path: /api/**
            serviceId:  SERVICE-SERVER


# EUREKA (Service registry)
eureka:
    instance:
        leaseRenewalIntervalInSeconds: 1
        leaseExpirationDurationInSeconds: 2
    client:
        serviceUrl:
            defaultZone: http://localhost:9999/eureka/

服务配置:

server:
    port: 8095
spring:
    application:
        name: service-server

eureka:
    instance:
        leaseRenewalIntervalInSeconds: 1
        leaseExpirationDurationInSeconds: 2
    client:
        serviceUrl:
            defaultZone: http://localhost:9999/eureka/

这是我的堆栈跟踪的简短版本:

  

com.netflix.zuul.exception.ZuulException:转发错误

     

引起:com.netflix.client.ClientException:重试次数   下一个服务器超过最多1次重试,同时拨打电话:   MBP-DE-安德烈:8095

     

引起:java.net.UnknownHostException:mbp-de-andre

2 个答案:

答案 0 :(得分:0)

<强> FIX: 所以,我最终成功地让它发挥作用!

我的问题来自我的Macbook主机名,

上次主机名为:mbp-de-andre

我修改它并设置:`MacBook-Pro-de-ANDRE.local``

答案 1 :(得分:0)

只想说另一个修复程序可能缺少依赖项:

 <div class="mat-sort-header-container">
  <button class="mat-sort-header-button" type="button" aria-label="Change sorting for 
   count"> Count </button>

  <div class="mat-sort-header-arrow ng-trigger ng-trigger-arrowPosition" 
   style="transform: translateY(25%); opacity: 0;">
    <div class="mat-sort-header-stem"></div><div class="mat-sort-header-indicator ng- 
     trigger ng-trigger-indicator" style="transform: translateY(0px);">
       <div class="mat-sort-header-pointer-left ng-trigger ng-trigger-leftPointer" 
        style="transform: rotate(-45deg);"></div>
       <div class="mat-sort-header-pointer-right ng-trigger ng-trigger-rightPointer" 
        style="transform: rotate(45deg);"></div>
       <div class="mat-sort-header-pointer-middle"></div>
     </div>
   </div>
</div>