Androidclient连接tomcat时出错:connect failed: ECONNREFUSED (Connection refused)

public static final String BASE_URL = "http://127.0.0.1:8090/HelloWord/"...;

会抛异常Caused by: libcore.io.ErrnoException: connect failed: ECONNREFUSED (Connection refused)


解决方法:

String url = "http://127.0.0.1:8090/HelloWord/"...;  改动成

public static final String BASE_URL = "http://192.168.3.14:8090/HelloWord"...;

主机ip不能使用localhost或者127.0.0.1,使用真实ip地址就可以。


posted on 2017-06-21 14:55  ljbguanli  阅读(794)  评论(0编辑  收藏  举报