Problem: Spring Cloud:com.sun.jersey.api.client.ClientHandlerException:java.net.UnknownHostException
阿新 • • 發佈:2018-12-16
Problem
com.sun.jersey.api.client.ClientHandlerException: java.net.UnknownHostException: mss-eureka1 Caused by: java.net.UnknownHostException: mss-eureka1 2018-12-05 18:22:08.232 WARN 18388 --- [ main] c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.UnknownHostException: mss-eureka1 2018-12-05 18:22:10.485 ERROR 18388 --- [ main] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error ...... com.sun.jersey.api.client.ClientHandlerException: java.net.UnknownHostException: mss-eureka2 Caused by: java.net.UnknownHostException: mss-eureka2 2018-12-05 18:22:10.491 WARN 18388 --- [ main] c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.UnknownHostException: mss-eureka2 2018-12-05 18:22:10.491 ERROR 18388 --- [ main] com.netflix.discovery.DiscoveryClient : DiscoveryClient_MSS-UPMS/192.168.1.123:9021 - was unable to refresh its cache! status = Cannot execute request on any known server ...... com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server ...... 2018-12-05 18:22:10.770 WARN 18388 --- [ main] com.netflix.discovery.DiscoveryClient : Using default backup registry implementation which does not do anything. 2018-12-05 18:22:10.771 INFO 18388 --- [ main] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 5 2018-12-05 18:22:10.772 INFO 18388 --- [ main] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4 2018-12-05 18:22:10.773 INFO 18388 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1544005330773 with initial instances count: 0 2018-12-05 18:22:10.776 INFO 18388 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application mss-upms with eureka with status UP 2018-12-05 18:22:10.777 INFO 18388 --- [ main] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1544005330777, current=UP, previous=STARTING] 2018-12-05 18:22:10.778 INFO 18388 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_MSS-UPMS/192.168.1.123:9021: registering service... 2018-12-05 18:22:10.781 INFO 18388 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647 2018-12-05 18:22:10.781 INFO 18388 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed 2018-12-05 18:22:10.785 ERROR 18388 --- [nfoReplicator-0] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error ......
Solution
// add two lines below in hosts file
C:\Windows\System32\Drivers\etc\hosts
127.0.0.1 mss-eureka1
127.0.0.1 mss-eureka2