Spring boot使用zuul网关超时解决方法:com.netflix.zuul.exception.ZuulException: Forwarding error

时间:2024-04-09 07:49:07

报错内容如下:

2020-08-29 00:26:51.232  WARN 43067 --- [io-20000-exec-6] o.s.c.n.z.filters.post.SendErrorFilter   : Error during filtering

com.netflix.zuul.exception.ZuulException: Forwarding error
Caused by: com.netflix.client.ClientException: null


Caused by: java.lang.RuntimeException: org.apache.http.conn.HttpHostConnectException: Connect to 192.168.1.104:10003 [/192.168.1.104] failed: Connection refused (Connection refused)

实际IP地址为:192.168.1.100,但是因为服务启动时间在几天前,电脑IP地址变更后,没有重启discovery服务,IP地址未更新导致gateway服务不可用。

Spring boot使用zuul网关超时解决方法:com.netflix.zuul.exception.ZuulException: Forwarding error

 

直接报错:500 Internal Server Error

Spring boot使用zuul网关超时解决方法:com.netflix.zuul.exception.ZuulException: Forwarding error

 

2020-08-29 00:53:09.703  INFO 44383 --- [io-20000-exec-4] c.n.l.DynamicServerListLoadBalancer      : DynamicServerListLoadBalancer for client order initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=order,current list of Servers=[192.168.1.100:10004],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone;    Instance count:1;    Active connections count: 0;    Circuit breaker tripped count: 0;    Active connections per server: 0.0;]
},Server stats: [[Server:192.168.1.100:10004;    Zone:defaultZone;    Total Requests:0;    Successive connection failure:0;    Total blackout seconds:0;    Last connection made:Thu Jan 01 08:00:00 CST 1970;    First connection made: Thu Jan 01 08:00:00 CST 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]
]}ServerList:org.springf[email protected]1ff7d948
2020-08-29 00:53:10.704  INFO 44383 --- [erListUpdater-1] c.netflix.config.ChainedDynamicProperty  : Flipping property: order.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2020-08-29 00:53:56.369  WARN 44383 --- [io-20000-exec-5] o.s.c.n.z.filters.post.SendErrorFilter   : Error during filtering com.netflix.zuul.exception.ZuulException: 

 

报错:Gateway Timeout:

{
    "timestamp": "2020-08-28T16:53:56.374+00:00",
    "status": 504,
    "error": "Gateway Timeout",
    "message": ""
 

加入超时时间设置:

bootstrap.yml

ribbon:
  ReadTimeOut: 30000
  ConnectTimeOut: 30000
hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 30000

configure中加入超时设置

zuul:
  host:
    socket-timeout-millis: 60000
    connect-timeout-millis: 60000

  sensitive-headers: true
  add-host-header: true
  prefix: /api/v1.0
  routes:

 

报错:java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing: None of labels [master] found

原因:git仓库地址连接错误导致,重试即可。
org.eclipse.jgit.api.errors.TransportException: https://github.com/test/configures: authentication not supported