【发布时间】:2012-10-27 17:45:13
【问题描述】:
我正在尝试从我的机构代理后面使用 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);
}
}
【问题讨论】:
-
如果您不发布生成错误所需的最少代码,我怀疑任何人都可以告诉您错误消息的确切内容。
标签: java json web-services resty