问题描述
使用场景:定时获取环信的消息记录。经常遇到链接不上服务器的问题。错误日志java.net.NoRouteToHostException) caught when connecting to {s}->https://a1.easemob.com:443: No route to host[INFO ] 2015-10-20 23:29:40 Method: org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:632)Retrying connect to {s}->https://a1.easemob.com:443[INFO ] 2015-10-20 23:29:40 Method: org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:624)I/O exception (java.net.NoRouteToHostException) caught when connecting to {s}->https://a1.easemob.com:443: No route to host[INFO ] 2015-10-20 23:29:40 Method: org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:632)Retrying connect to {s}->https://a1.easemob.com:443[INFO ] 2015-10-20 23:29:40 Method: org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:624)I/O exception (java.net.NoRouteToHostException) caught when connecting to {s}->https://a1.easemob.com:443: No route to host[INFO ] 2015-10-20 23:29:40 Method: org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:632)Retrying connect to {s}->https://a1.easemob.com:443che.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:632)Retrying connect to {s}->https://a1.easemob.com:443[INFO ] 2015-10-20 23:29:40 Method: org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:624)I/O exception (java.net.NoRouteToHostException) caught when connecting to {s}->https://a1.easemob.com:443: No route to host[INFO ] 2015-10-20 23:29:40 Method: org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:632)Retrying connect to {s}->https://a1.easemob.com:443
解决方案
这是Linux系统下面的?看上去是虚拟机吧,说的是网段不对,虚拟机的网络是虚拟的,有自己的设置,你自己设置 IP 很容易错的。如果你的实体机及有局域网和 DHCP 服务,那么直接 DHCP 就可以了。
解决方案二:
是centos。阿里云的服务器。