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

54,869

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.

Share:
54,869
Samar
Author by

Samar

Updated on July 09, 2022

Comments

  • Samar
    Samar almost 2 years

    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.

  • Jose
    Jose over 9 years
    Hi! Im having the same issue, please, could you clarify about your solution?
  • Samar
    Samar over 9 years
    Solution is to make sure you don't keep-alive(default) the connection. Set it to close after each request/response.
  • user3792852
    user3792852 over 7 years
    Setting keep-alive to false, by the way, can be done by setting the network property -Dhttp.keepAlive=false as VM parameter during startup, e.g. java -Dhttp.keepalive=false....