Caused by: java.net.SocketException: Unexpected end of file from server

Samar picture Samar · Mar 3, 2014 · Viewed 47.1k times · Source

I am getting the below error quite intermittently when i run the WS through SOAP UI. Sometimes it does not work and then it keeps working and then again sometimes it does not work. One other issue is the test web service works fine provided by client with no issues but moment we switch to the production one it gives issues. Googled and did some changes (timeout on HttpConfig , jetty maxIdleTime) but still cant make it work :( Any ideas how i can narrow down what the issue is ?

org.apache.cxf.interceptor.Fault: Could not send Message.
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)[147:org.apache.cxf.cxf-api:2.6.0.redhat-60024]
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)[147:org.apache.cxf.cxf-api:2.6.0.redhat-60024]

Caused by: java.net.SocketException: SocketException invoking https://www.website:443/gateway/ServicePortV2: Unexpected end of file from server
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.7.0_25]



Caused by: java.net.SocketException: Unexpected end of file from server
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:718)[:1.7.0_25]
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:579)[:1.7.0_25]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1322)[:1.7.0_25]
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)[:1.7.0_25]
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)[:1.7.0_25]
    at org.apache.cxf.transport.http.HTTPConduit.processRetransmit(HTTPConduit.java:1004)[159:org.apache.cxf.cxf-rt-transports-http:2.6.0.redhat-60024]
    at org.apache.cxf.transport.http.HTTPConduit.access$400(HTTPConduit.java:148)[159:org.apache.cxf.cxf-rt-transports-http:2.6.0.redhat-60024]
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRetransmits(HTTPConduit.java:1504)[159:org.apache.cxf.cxf-rt-transports-http:2.6.0.redhat-60024]
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1525)[159:org.apache.cxf.cxf-rt-transports-http:2.6.0.redhat-60024]
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1438)[159:org.apache.cxf.cxf-rt-transports-http:2.6.0.redhat-60024]

Just to add using SOAP UI with the production endpoint works fine.

Answer

Samar picture Samar · Mar 18, 2014

We finally found out that the server side has a connection timeout set so our keep alive connections would timeout after the allocated time and hence the intermittent errors. Changed connection to close each time and all good now.