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)

为什么我exception在尝试连接到web-service. 我在堆栈溢出中搜索相关错误,但实际上无法弄清楚为什么?

4

1 回答 1

-1

我将假设“com.Webservice.downloadFileAddPassword”是您创建的包,而您的 Web 服务是 Webservice.java。如果这是真的,那么您的 Webservice.java 的第 192 行有一个错误。这并不是说您可能没有访问 Web 服务,而是您的 Web 服务中的操作时间或进程正在超时。您是否对您的网络服务进行了单元测试?

我在堆栈跟踪中读到您有一个正在调用的 InputStream,当您尝试连接或从源读取时,它会花费太长时间而超时。http://docs.oracle.com/javase/7/docs/api/java/net/SocketTimeoutException.html

所以基本上:webservice 使用的输入流耗时太长。我认为我知道的还不够多,只能查看您的堆栈跟踪并提供更多信息。

Stack Trace 作为一种更易读的格式:

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)
于 2013-07-18T13:58:54.680 回答