已解决
springcloudgateway 默认转发不生效
来自网友在路上 130830提问 提问时间:2023-09-27 06:23:55阅读次数: 30
最佳答案 问答题库308位专家为你答疑解惑
配置文件配置了自动转发
spring.cloud.gateway.discovery.locator.enabled= true
但是用微服务路径访问时一直报503
[fa9cc893-1] There was an unexpected error (type=Service Unavailable, status=503).
这个503看得我是一头雾水。原因在于这个默认错误页的报错显示不全,需要开启两个配置帮助检查
#输出错误页的异常信息
server.error.include-message=always
#输出错误页的异常栈(开发环境开启,生产环境关闭)
server.error.include-stacktrace=always
开启后看报错内容好多了
[fa9cc893-1] There was an unexpected error (type=Service Unavailable, status=503).
Unable to find instance for user-center
org.springframework.cloud.gateway.support.NotFoundException: 503 SERVICE_UNAVAILABLE "Unable to find instance for user-center"at org.springframework.cloud.gateway.support.NotFoundException.create(NotFoundException.java:45)
报错原因为找不到微服务实例
根据关键词搜索找到这么一篇Sping Cloud Gateway Unable to find instance for_jonhy.luo的博客-CSDN博客
废弃ribbon这个跟我这个有点像,我的spring cloud alibaba版本为2021.0.5.0,spring cloud 版本为2021.0.5
增加loadbalance依赖
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
重新启动gateway工程,默认转发正常了。
查看全文
99%的人还看了
相似问题
- 【Vue3】解决Vue打包后上传服务器 资源路径加载错误
- 实时错误’-2147217887‘多步OLB DB 操作产生错误。如果可能,请检查OLE DB状态值
- 解决requests 2.28.x版本SSL错误:证书验证失败
- ODBC配置数据源及相关问题(“找不到工程和库”“实时错误91对象变量或with块变量未设置”等)
- 微信小程序发货信息录入接口 错误上传时间非法,请按照 RFC 3339 格式填写?
- Python基础:错误和异常
- SourceTree提示128错误
- PHPmail 发送邮件错误 550 的原因是什么?
- 一段来自《Verilog HDL 高级数字设计》的错误Verilog代码
- NVS 错误码对应的原因
猜你感兴趣
版权申明
本文"springcloudgateway 默认转发不生效":http://eshow365.cn/6-14464-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!
- 上一篇: C语言数组和指针笔试题(三)(一定要看)
- 下一篇: AI智能电话机器人实用吗