HttpClient不能连接外网
不知道有谁用过HttpClient没有,在网上查了很久,也弄了些源码来跑,还是不能连出去,我使用的是公司的网络,不可以连接出去,连接内部的网页可以.Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.http.conn.PlainSocketFactory.connectSocket(PlainSocketFactory.java:110)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:134)
不知道是不是认证的问题,高手指点.
搜索更多相关的解决方案:
HttpClient
----------------解决方案--------------------------------------------------------
HttpClient是一个很优秀的包,不可能不能连外网的
从异常来看,不是你连不上,而是你的连接被拒绝了,
----------------解决方案--------------------------------------------------------
就是被拒绝了,不知道为什么,连内部的网页是可以的,但是连接出去的话就被拒绝,没搞清楚原因.请指点一下.
----------------解决方案--------------------------------------------------------
org.apache.http.conn.HttpHostConnectException: Connection to [url]http://www.baidu.com[/url] refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:138)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at org.apache.http.impl.client.DefaultClientRequestDirector.execute(DefaultClientRequestDirector.java:283)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:524)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:476)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:435)
at hp.japan.HttpRequest.send(HttpRequest.java:62)
at hp.japan.JapanWords.actionPerformed(JapanWords.java:59)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.http.conn.PlainSocketFactory.connectSocket(PlainSocketFactory.java:110)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:134)
----------------解决方案--------------------------------------------------------
问你的网管了
----------------解决方案--------------------------------------------------------