HttpHostConnectException: Connection to http://jsjtt.com refused
java 请求url时报错:org.apache.http.conn.HttpHostConnectException: Connection to http://jsjtt.com refused
详细错误:
org.apache.http.conn.HttpHostConnectException: Connection to http://jsjtt.com refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
“connection refused”错误是当你尝试打开一个TCP连接的IP地址/端口被拒绝
调查方法:
查看子啊同一台服务器上是否能够运行,如何考虑是否有防火墙阻隔(关闭防护墙再试)
调查是否是代理问题。
本人把linux防护墙关闭后访问成功。
其他说明 如果在android开发中遇到此类错误需要在配置文件中加入访问权限
<uses-permission android:name="android.permission.INTERNET" />