Exception in thread “main” org.apache.axis2.AxisFault: Read timed out

旧城冷巷雨未停 提交于 2020-01-05 08:47:22

问题


I wrote a web service and web client was generated using Eclipse wizard. And my client application is requesting a String and also an Object. The string can be retrieved successfully and when I tried to retrieve the object it gives the following exception (I'm using JBoss 5):

Exception in thread "main" org.apache.axis2.AxisFault: Read timed out
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:203)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at se.cambio.cimonitor.ws.implmnt.GetDataStub.retrieveDetails(GetDataStub.java:203)
at se.cambio.cimonitor.ws.client.WebServiceClient.main(WebServiceClient.java:44)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1373)
at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:560)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)

I cannot find a way out, please help me.


回答1:


I can only provide help from the only exception stack trace you've place.

The root cause of the exception is:

Caused by: java.net.SocketTimeoutException: Read timed out

It means that a timeout has occurred when the socket tried to read or accept. In your case there was a read timeout.

You need to figure out what is your socket timeout to the service server box and if you can, make it live indefinitely.




回答2:


I ran into this error on a project, and the root cause was a proxy server setting. I had to modify the proxy to allow the communication to the service I was trying to hit. My code was running as part of a custom application that used its own proxy. So this may also be something to try.




回答3:


Finally I could overcome the problem. My object was an object which contains another objects inside that. Then I construct a one object with String and int and could send successfully.

Thank you...




回答4:


We faced similar issue and we were getting Read Time Out while trying to invoke a secured webservice, after a long analysis we found out that there was a mismatch in the transport protocol version. Web-service was servicing on http1.0 and we were invoking it using http1.1. We modified the protocol version in our client code which resolves this issue:

Below is the code to specify http version-1.0 options.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION, org.apache.axis2.transport.http.HTTPConstants.HEADER_PROTOCOL_10);



来源:https://stackoverflow.com/questions/7412254/exception-in-thread-main-org-apache-axis2-axisfault-read-timed-out

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!