3

Jsoup でタイムアウト エラーが発生しています。どうすればこれを修正できますか?

エラーを与えるコード行は

Document doc;
doc = Jsoup.connect("http://google.com").timeout(300000).get();

私が得ている例外は

java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:150)
    at java.net.SocketInputStream.read(SocketInputStream.java:121)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:633)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:579)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1322)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
    at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:412)
    at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:393)
    at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:159)
    at org.jsoup.helper.HttpConnection.get(HttpConnection.java:148)
4

2 に答える 2

4

あなたはプロキシの背後にいると思います。プロキシの詳細がわかっている場合は、次のことを試すことができます。

System.setProperty("http.proxyHost", "147.167.10.2");//replace with your proxy host
System.setProperty("http.proxyPort", "8080");//replace with your proxy port
Document doc = Jsoup.connect("http://google.com").get();
于 2013-02-18T18:03:20.293 に答える