2011-02-08 73 views
1

我正在使用一个.net应用程序,该应用程序使用基于CXF的Web服务的数据,并且遇到了一个奇怪的断开连接问题。虽然我已经设置所有适当的超时,我能想到的两侧,如果请求超过30秒需要更长的时间左右,那么连接是越来越坏,我得到了以下错误超时问题消费来自.Net的CXF Web服务

在CXF

at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:212) 
    at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450) 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: com.ctc.wstx.exc.WstxIOException: null 
    at com.ctc.wstx.sw.BaseStreamWriter._finishDocument(BaseStreamWriter.java:1431) 
    at com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:553) 
    at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:282) 
    ... 39 more 
Caused by: org.eclipse.jetty.io.EofException 
    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:148) 
    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:92) 
    at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:46) 
    at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:55) 
    at java.util.zip.GZIPOutputStream.writeHeader(GZIPOutputStream.java:123) 
    at java.util.zip.GZIPOutputStream.<init>(GZIPOutputStream.java:48) 
    at java.util.zip.GZIPOutputStream.<init>(GZIPOutputStream.java:58) 
    at org.apache.cxf.transport.common.gzip.GZIPOutInterceptor$GZipThresholdOutputStream.thresholdReached(GZIPOutInterceptor.java:284) 
    at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:62) 
    at org.apache.cxf.io.CacheAndWriteOutputStream.write(CacheAndWriteOutputStream.java:68) 
    at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:100) 
    at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:225) 
    at com.ctc.wstx.sw.BufferingXmlWriter.close(BufferingXmlWriter.java:198) 
    at com.ctc.wstx.sw.BaseStreamWriter._finishDocument(BaseStreamWriter.java:1429) 
    ... 41 more 

和.NET错误

The underlying connection was closed: The connection was closed unexpectedly. ---> System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly. 

这似乎是WCF和许多不同问题的根源默认的错误。

如果我使用SoapUi连接到CXF服务,并在其中一个操作中放置断点,我可以延迟响应的时间超过30秒的超时时间,并且一旦允许它恢复,则恢复无需一个问题和它导致我相信它正在做断开连接的.net端。

.net客户端配置了所有适当的超时时间,它们远远大于我遇到的30秒时间。

<binding name="serviceBinding" sendTimeout="20:00:00" receiveTimeout="20:00:00" openTimeout="20:00:00" closeTimeout="20:00:00"> 
    <gzipMessageEncoding /> 
    <httpTransport manualAddressing="false" decompressionEnabled="False" maxBufferPoolSize="2147483647"  
      maxReceivedMessageSize="2147483647" allowCookies="false" authenticationScheme="Anonymous" 
      bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true"  
      maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous" 
      realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" /> 
</binding> 

还有什么可能会在这里干扰和连接断开? gzipMessageEncoding是非标准的,但在请求小于30秒的所有情况下都能正常工作。我非常乐意接受任何建议。

谢谢

Steve。

回答

1

错误消息不匹配,但您可能想看看here。异步操作有一个单独的超时,您只能通过代码进行配置,这可能是您正在运行的那个异常操作(尽管正如我所说的,错误消息似乎不匹配)。实际的文档是here

您可能还想使用WireShark来查看是​​否可以捕获实际的底层TCP断开连接消息,并查看哪一方实际启动了断开连接。

+0

谢谢你的指针Ken,唉,这已经被尝试过了。尽管干杯! – sgargan 2011-02-08 18:11:18