android 从tomcat读取文件出错:connect failed: ECONNREFUSED

来源:互联网 发布:db2 sql查询取第一条 编辑:程序博客网 时间:2024/05/17 01:13

java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 8080):
connect
failed: ECONNREFUSED (Connection refused)

...
....
....

解决方法:

String url = "http://localhost:8080/notice/test.txt";  修改成 String url = "http://本机IP:8080/notice/test.txt";

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

0 0
原创粉丝点击