RestTemplate java.net.UnknownHostException

懵懂的女人 提交于 2020-10-29 22:40:38

背景:公司内部系统的架构升级准备用微服务一套;记录遇到的坑。

错误信息:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; 
nested exception is org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://PROVIDER/add": PROVIDER;
nested exception is java.net.UnknownHostException: PROVIDER] with root cause java.net.UnknownHostException: PROVIDER

 看到有人说修改localhost 为本机IP 尝试也没有效果

 

 

上面是引起错误的代码。

这是正确的代码

加上@LoadBalanced

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!