2011-10-19 115 views
1

我目前正在開發一個Java應用程序,並使用Apache HttpClient 4.1.2。問題是,當我試圖創建X-HTTP-方法,覆蓋頭部上設置了POST請求「PUT」我得到以下錯誤:JAVA Apache HttpClient SSL TimedOut

java.net.SocketTimeoutException: Read timed out 
    at java.net.SocketInputStream.socketRead0(Native Method) 
    at java.net.SocketInputStream.read(SocketInputStream.java:129) 
    at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293) 
    at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331) 
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:789) 
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:746) 
    at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75) 
    at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:149) 
    at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:110) 
    at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:264) 
    at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:98) 
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252) 
    at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281) 
    at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:247) 
    at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:219) 
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:298) 
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) 
    at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:645) 
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:464) 
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820) 
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754) 
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732) 
    at requests.BlahBlahClass.run(BlahBlahClass.java:83) 
    at java.lang.Thread.run(Thread.java:619) 

我想不出什麼問題。誰能幫幫我嗎?謝謝!

回答

2

您的客戶端超時等待響應。超時時間太短或服務器卡在某處。

+0

謝謝你的提示。我已將超時設置爲50秒,現在一切正常。 –

相關問題