You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by xuhb <xu...@tongtech.com> on 2011/07/08 12:34:26 UTC

Exception(Unexpected end of file from server) of CXF

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

Re: Exception(Unexpected end of file from server) of CXF

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

I believe this is the same issue as I encountered recently, please see  
my post here[1]

[1]http://cxf.547215.n5.nabble.com/Caused-by-java-net-SocketException-Unexpected-end-of-file-from-server-td4715340.html

Freeman
On 2011-7-8, at 下午6:34, xuhb wrote:

> 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

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










Re: Exception(Unexpected end of file from server) of CXF

Posted by Willem Jiang <wi...@gmail.com>.
On 7/8/11 6:34 PM, xuhb wrote:
> 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;
>
What kinds of response does your client expect?

> 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;
>

Did you have a chance to catch the under layer TCP transport between the 
server and client. It's easy to tell the difference of your two test 
case if you catch the packages between the client and server.
> 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


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: Exception(Unexpected end of file from server) of CXF

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

I believe this is the same issue as I encountered recently, please see  
my post here[1]

[1]http://cxf.547215.n5.nabble.com/Caused-by-java-net-SocketException-Unexpected-end-of-file-from-server-td4715340.html

Freeman
On 2011-7-8, at 下午6:34, xuhb wrote:

> 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

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com