解决使用springcloud zuul出现Forwarding error错误

使用zuul进行网关过滤请求时出现Forwarding error错误:

2019-04-21 12:39:29.332  INFO [service-zuul,5aadd031214b12da,5aadd031214b12da,false] 14644 --- [nio-7020-exec-3] com.cxh.study.platform.filter.MyFilter   : POST >>> http://127.0.0.1:7020/api-a/user/insertUser
url:http://127.0.0.1:7020/api-a/user/insertUser
2019-04-21 12:39:34.039  WARN [service-zuul,5aadd031214b12da,5aadd031214b12da,false] 14644 --- [nio-7020-exec-3] o.s.c.n.z.filters.post.SendErrorFilter   : Error during filtering

com.netflix.zuul.exception.ZuulException: Forwarding error
	at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.handleException(RibbonRoutingFilter.java:170) ~[spring-cloud-netflix-core-1.2.6.RELEASE.jar:1.2.6.RELEASE]
	at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:145) ~[spring-cloud-netflix-core-1.2.6.RELEASE.jar:1.2.6.RELEASE]
	at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:88) ~[spring-cloud-netflix-core-1.2.6.RELEASE.jar:1.2.6.RELEASE]
	at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112) ~[zuul-core-1.3.0.jar:1.3.0]
	at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:193) ~[zuul-core-1.3.0.jar:1.3.0]
	at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:157) ~[zuul-core-1.3.0.jar:1.3.0]
	at com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:118) ~[zuul-core-1.3.0.jar:1.3.0]
	at com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:96) ~[zuul-core-1.3.0.jar:1.3.0]

解决方法:


zuul:
  host:
     socket-timeout-millis: 60000
     connect-timeout-millis: 60000
  routes:
    #不用验证
    api-a:
      path: /api-a/**
      serviceId: provider8010
    #需要验证
    api-b:
      path: /api-b/**
      serviceId: provider8010
    api-p:
      path: /api-p/**
      serviceId: provider8010


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

ribbon:
  ReadTimeout: 60000
  ConnectTimeout: 60000

再次发起请求时,获取数据正常。

我的座右铭:不会,我可以学;落后,我可以追赶;跌倒,我可以站起来;我一定行。

你可能感兴趣的:(bug错误相册)