Recently I always encounter a "Unexpected end of file from server" Exception at 
CXF client side.  it seems this exception is caused by  the CXF Serverside has 
unexcepted release the http connection ;

 I tried some effort to to use a simple test case to regenerate such a 
exception; Following is a simple test case which will cause such a exception.

keypoint of the test case:
1)MTOM enabled;
2)Using Jetty-Transport at serverside, and using SUN JDK's http client at 
client side;
3)the service logical is simple: first consume all attachment and close it; 
then wait for a long time (about 10 miniutes);
In practice, there is no such a service which will block for so long time, but 
in the simple test case, I must use such a long time to force such a exception 
occurs;

4)set the client side 's receiveTime to a infinite time(almost) to avoid 
receive time out exception. then the client will block to wait service , but 
after about 7 minutes a ""Unexpected end of file from server"  Exception will 
raised at client side;

Other key points I have tried:
1)At first I guess maybe this is the jetty-server's problem: I guess it will 
release connection  silently while the servlet-handler execute too long time; 
  But unfortunately it 's not so . 

Because I tried another simple test case, which doesnt generate such a 
exception . The only difference is: there is no attachment in xml data; Also 
the service will wait a very long time( 10minutes, 20minutes I have tried) . 
And the client will blocking util service returned;

Ps: the stack of the Exception is :

org.apache.cxf.interceptor.Fault: Could not send Message.
 at 
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
...
Caused by: java.net.SocketException: SocketException invoking 
http://localhost:9000/service/moreattachmentsrpcliteral: Unexpected end of file 
from server
...
 at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1385)
 at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1370)
...
Caused by: java.net.SocketException: Unexpected end of file from server
 at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:763)
 at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:626)
 at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:760)
 at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:626)
 at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:983)
 at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:367)
 at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1490)
 at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1448)
 at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1356)
 ... 35 more

Reply via email to