| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2306 人关注过本帖
标题:HttpClient不能连接外网
只看楼主 加入收藏
mycxsky
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2005-12-18
收藏
 问题点数:0 回复次数:4 
HttpClient不能连接外网
不知道有谁用过HttpClient没有,在网上查了很久,也弄了些源码来跑,还是不能连出去,我使用的是公司的网络,不可以连接出去,连接内部的网页可以.

Caused by: Connection refused: connect
    at (Native Method)
    at (Unknown Source)
    at (Unknown Source)
    at (Unknown Source)
    at (Unknown Source)
    at (Unknown Source)
    at org.apache.http.conn.PlainSocketFactory.connectSocket(PlainSocketFactory.java:110)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:134)

不知道是不是认证的问题,高手指点.
搜索更多相关主题的帖子: HttpClient 
2007-12-26 19:09
千里冰封
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:灌水之王
等 级:版主
威 望:155
帖 子:28477
专家分:59
注 册:2006-2-26
收藏
得分:0 
HttpClient是一个很优秀的包,不可能不能连外网的
从异常来看,不是你连不上,而是你的连接被拒绝了,

可惜不是你,陪我到最后
2007-12-26 19:40
mycxsky
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2005-12-18
收藏
得分:0 
就是被拒绝了,不知道为什么,连内部的网页是可以的,但是连接出去的话就被拒绝,没搞清楚原因.请指点一下.
2007-12-26 20:17
mycxsky
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2005-12-18
收藏
得分:0 
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.(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.(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.(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: Connection refused: connect
    at (Native Method)
    at (Unknown Source)
    at (Unknown Source)
    at (Unknown Source)
    at (Unknown Source)
    at (Unknown Source)
    at org.apache.http.conn.PlainSocketFactory.connectSocket(PlainSocketFactory.java:110)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:134)
2007-12-26 20:19
千里冰封
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:灌水之王
等 级:版主
威 望:155
帖 子:28477
专家分:59
注 册:2006-2-26
收藏
得分:0 
问你的网管了

可惜不是你,陪我到最后
2007-12-26 22:07
快速回复:HttpClient不能连接外网
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016632 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved