eureka resttemplate ResourceAccessException: I/O error on GET request for “http://PRODUCET-SERVI

eureka resttemplate ResourceAccessException: I/O error on GET request for "http://PRODUCET-SERVI

参考:https://blog.csdn.net/q11w2212/article/details/81709068

eureka 的 多提供服务者 消费者进行消费(不固定)

需要在

@Bean
    @LoadBalanced// 负载均衡  轮询
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

原本错误:

2021-03-30 21:15:04.027 ERROR 16320 --- [nio-9002-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : 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://PRODUCET-SERVICE/tbProduct/1": PRODUCET-SERVICE; nested exception is java.net.UnknownHostException: PRODUCET-SERVICE] with root cause

java.net.UnknownHostException: PRODUCET-SERVICE
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) ~[na:1.8.0_40]
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_40]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_40]
	at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_40]
	at java.net.Socket.connect(Socket.java:538) ~[na:1.8.0_40]
	at sun.net.NetworkClient.doConnect(NetworkClient.java:180) ~[na:1.8.0_40]
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) ~[na:1.8.0_40]
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) ~[na:1.8.0_40]
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:211) ~[na:1.8.0_40]
	at sun.net.www.http.HttpClient.New(HttpClient.java:308) ~[na:1.8.0_40]

你可能感兴趣的:(eureka resttemplate ResourceAccessException: I/O error on GET request for “http://PRODUCET-SERVI)