我正试图从我的机构代理背后使用Resty。我想出了这个例外
Exception in thread "main" java.net.ConnectException: Connection refused: connect有人能告诉我为什么我会得到这个异常吗?
下面是完整的代码:
package models;
import static us.monoid.web.Resty.*;
import us.monoid.web.Resty;
import us.monoid.web.Resty.*;
public class Tracks {
public static void main(String args[])throws Exception{
Resty r= new Resty();
String s = r.json("http://ws.geonames.org/postalCodeLookupJSON?"+
"postalcode=66780&country=DE").get("postalcodes[0].placeName").toString();
//String s=r.json("http://ws.audioscrobbler.com/2.0/?method=geo.gettopartists&country=spain&api_key=4174709b0d420c7080c7ac75e6944f1c&format=json").get("topartists[0].artist[0].name").toString();
System.out.println(s);
}
}发布于 2012-10-28 01:46:50
看起来你的访问被阻止了。您连接到了错误的目标,或者它根本没有运行。
验证您的网络连接是否正常。通常,在存在代理的情况下,直接访问会被阻止。根据您正在执行的操作,您可以使用该代理,也可以为您请求防火墙规则。
https://stackoverflow.com/questions/13102575
复制相似问题