2013-07-18 178 views
0
07-18 18:57:24.687: W/System.err(7031): java.net.SocketTimeoutException: Read timed out 
07-18 18:57:24.773: W/System.err(7031):  at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_read(NativeMethod) 
07-18 18:57:24.773: W/System.err(7031):  at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:675) 
07-18 18:57:24.773: W/System.err(7031):  at libcore.io.Streams.readSingleByte(Streams.java:41) 
07-18 18:57:24.773: W/System.err(7031):  at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:659) 
07-18 18:57:24.773: W/System.err(7031):  at libcore.io.Streams.readAsciiLine(Streams.java:201) 
07-18 18:57:24.773: W/System.err(7031):  at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:560) 
07-18 18:57:24.773: W/System.err(7031):  at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:813) 
07-18 18:57:24.773: W/System.err(7031):  at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274) 
07-18 18:57:24.773: W/System.err(7031):  at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168) 
07-18 18:57:24.773: W/System.err(7031):  at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:271) 
07-18 18:57:24.773: W/System.err(7031):  at com.Webservice.downloadFileAddPassword(Webservice.java:192) 
07-18 18:57:24.777: W/System.err(7031):  at com.patientcontext.DocumentViewerActivity2$DocumentsShowAsyncTask.doInBackground(DocumentViewerActivity2.java:219) 
07-18 18:57:24.777: W/System.err(7031):  at com.patientcontext.DocumentViewerActivity2$DocumentsShowAsyncTask.doInBackground(DocumentViewerActivity2.java:1) 
07-18 18:57:24.777: W/System.err(7031):  at android.os.AsyncTask$2.call(AsyncTask.java:287) 
07-18 18:57:24.777: W/System.err(7031):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 
07-18 18:57:24.777: W/System.err(7031):  at java.util.concurrent.FutureTask.run(FutureTask.java:137) 
07-18 18:57:24.777: W/System.err(7031):  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 
07-18 18:57:24.781: W/System.err(7031):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 
07-18 18:57:24.785: W/System.err(7031):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 
07-18 18:57:24.785: W/System.err(7031):  at java.lang.Thread.run(Thread.java:856) 

爲什麼我在嘗試連接到web-service時得到這個exception。我在堆棧溢出搜索相關的錯誤,但實際上找不到爲什麼?java.net.SocketTimeoutException:讀取超時問題

+0

代替使用asyntask的'AsyncTasks應當理想地(最多幾秒)'[AsyncTasks API文檔](HTTP用於短操作: //developer.android.com/reference/android/os/AsyncTask.html)。你爲什麼不使用Service或Downloadmanager?關於你的例外,讓我們看看人們說:) – AlexBcn

回答

-1

我打算假設「com.Webservice.downloadFileAddPassword」是您創建的包,而您的Web服務是Webservice.java。如果這是真的,那麼您的Webservice.java的第192行出現錯誤。它並不是說你可能沒有選擇網絡服務,但是運行時間或網絡服務中的流程已經超時。你是否測試過你的網絡服務?

我在堆棧跟蹤中看到,當您嘗試連接或從源讀取時調用了InputStream時,它在超時時間太長。 http://docs.oracle.com/javase/7/docs/api/java/net/SocketTimeoutException.html

所以基本上:webservice使用的輸入流花費的時間太長。我不認爲我足夠了解僅查看堆棧跟蹤並提供更多信息。

堆棧跟蹤作爲更可讀的格式:

07-18 18:57:24.687: W/System.err(7031): java.net.SocketTimeoutException: Read timed out 
07-18 18:57:24.773: W/System.err(7031): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_read(Native Method) 
07-18 18:57:24.773: W/System.err(7031): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:675) 
07-18 18:57:24.773: W/System.err(7031): at libcore.io.Streams.readSingleByte(Streams.java:41) 
07-18 18:57:24.773: W/System.err(7031): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:659) 
07-18 18:57:24.773: W/System.err(7031): at libcore.io.Streams.readAsciiLine(Streams.java:201) 
07-18 18:57:24.773: W/System.err(7031): at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:560) 
07-18 18:57:24.773: W/System.err(7031): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:813) 
07-18 18:57:24.773: W/System.err(7031): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274) 
07-18 18:57:24.773: W/System.err(7031): at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168) 
07-18 18:57:24.773: W/System.err(7031): at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:271) 
07-18 18:57:24.773: W/System.err(7031): at com.Webservice.downloadFileAddPassword(Webservice.java:192) 
07-18 18:57:24.777: W/System.err(7031): at com.patientcontext.DocumentViewerActivity2$DocumentsShowAsyncTask.doInBackground(DocumentViewerActivity2.java:219) 
07-18 18:57:24.777: W/System.err(7031): at com.patientcontext.DocumentViewerActivity2$DocumentsShowAsyncTask.doInBackground(DocumentViewerActivity2.java:1) 
07-18 18:57:24.777: W/System.err(7031): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
07-18 18:57:24.777: W/System.err(7031): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 
07-18 18:57:24.777: W/System.err(7031): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 
07-18 18:57:24.777: W/System.err(7031): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 
07-18 18:57:24.781: W/System.err(7031): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 
07-18 18:57:24.785: W/System.err(7031): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 
07-18 18:57:24.785: W/System.err(7031): at java.lang.Thread.run(Thread.java:856) 
+0

否。* SSL握手*超時。查看堆棧跟蹤。 – EJP

相關問題