眉头
2018-05-22 02:52
采纳率: 100%
浏览 3.6k
已采纳

springcloud zuul fallback 回退返回数据异常

我的eureka中注册了user服务 和 gateway-zuul-fallback 服务
直接访问user服务localhost:8081/user/getUser?id=1 没问题
通过zuul访问userlocalhost:8097/user/user/getUser?id=1 也没问题
zuul服务yml配置:
图片说明
fallbackConfig
图片说明

我把 user服务挂掉,通过zuul代理访问报以下错误:(怎么返回的不是fallback error string)
2018-05-22 10:46:33.835 WARN 9020 --- [nio-8097-exec-9] o.s.c.n.z.filters.post.SendErrorFilter : Error during filtering
com.netflix.zuul.exception.ZuulException: null
at org.springframework.cloud.netflix.zuul.util.ZuulRuntimeException.(ZuulRuntimeException.java:33) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:119) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar:1.4.4.RELEASE]
Caused by: java.lang.NullPointerException: null
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:159) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:111) ~[spring-cloud-netflix-core-1.4.4.RELEASE.jar:1.4.4.RELEASE]
... 66 common frames omitted
页面返回:
{
"timestamp": 1526956683342,
"status": 500,
"error": "Internal Server Error",
"exception": "com.netflix.zuul.exception.ZuulException",
"message": "No message available"
}

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • DengDengLei 2018-05-22 03:45
    已采纳

    将MyFallBackConfig中的getRoute()方法修改为return "user";

    已采纳该答案
    打赏 评论
  • 灵魂架构师 2018-05-22 02:59

    debug显示哪行报错

    打赏 评论

相关推荐 更多相似问题