Request URI does not contain a valid hostname:http://xxx

初学SpringCloud遇到的坑,估计很多人都踩过:

问题描述:
“org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: Request URI does not contain a valid hostname: http://xxx/xxx”。

分析:

springcloud ribbon实现负载均衡的时候,提示Request URI does not contain a valid hostname: http://xxx/xxx;意思就是:请求 URI 不包含有效的主机名,又或者说服务的主机名不存在、命名不规范等。

解决方案:
使用ribbon实现负载均衡的时候,服务名称不能用下划线,换成中划线。
实际上用Feign,内部自带了ribbon.

原文链接:https://blog.csdn.net/weixin_42888533/article/details/99850134

 

posted @ 2021-07-03 01:10  向着阳光漫步  阅读(918)  评论(0编辑  收藏  举报