iCMS

Eureka error "java.net.UnknownHostException:

iCMS http://www.hlike.cn 2018-05-31 15:42 出处:网络 编辑:@iCMS
好喜欢专业转载优质博客文章的地方哦~

spring cloud 中zuul智能路由,本地部署没有问题,部署到服务器就报com.netflix.zuul.exception.ZuulException: Forwarding error

项目中用到spring cloud+docker,各个组件本地部署没有,一部署在服务器就出现问题,报如下的错误

com.netflix.zuul.exception.ZuulException: Forwarding error

at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.handleException(RibbonRoutingFilter.java:189) ~[spring-cloud-netflix-zuul-2.0.0.RC1.jar!/:2.0.0.RC1]

at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:164) ~[spring-cloud-netflix-zuul-2.0.0.RC1.jar!/:2.0.0.RC1]

at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:112) ~[spring-cloud-netflix-zuul-2.0.0.RC1.jar!/:2.0.0.RC1]

at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:117) ~[zuul-core-1.3.1.jar!/:1.3.1]

at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:193) ~[zuul-core-1.3.1.jar!/:1.3.1]

at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:157) ~[zuul-core-1.3.1.jar!/:1.3.1]

at com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:118) ~[zuul-core-1.3.1.jar!/:1.3.1]

at com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:96) ~[zuul-core-1.3.1.jar!/:1.3.1]

at com.netflix.zuul.http.ZuulServlet.route(ZuulServlet.java:116) ~[zuul-core-1.3.1.jar!/:1.3.1]

at com.netflix.zuul.http.ZuulServlet.service(ZuulServlet.java:81) ~[zuul-core-1.3.1.jar!/:1.3.1]

从网上找各种资源都没找到,包括找springcloud 开源社区发帖

关键在于-----

在配置文件加入

eureka:

client:

serviceUrl:

defaultZone: http://XXX:8080/eureka/

#这里才是关键

fetch-registry: true

register-with-eureka: true

#服务注册中心实例的主机名

eureka.instance.hostname=localhost

#是否向服务注册中心注册自己

eureka.client.register-with-eureka=true

#是否检索服务

eureka.client.fetch-registry=true

0

精彩评论

暂无评论...
验证码 换一张
取 消

热门标签