CXF:套接字超时例外

时间:2011-11-22 21:35:55

标签: web-services cxf

我使用Apache CXF实现了Web服务。 流程是这样的:

1.当我们向Webservice发出请求时,我们将从中获取输入参数。 2.在Obtained Input参数中,我们在内部调用另一个Web服务。

在我的JSP中,我已经给出了以下内容

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
 factory.setServiceClass(MyWebService.class);
 factory.setAddress(host);

     MyWebService client = (MYWebService) factory.create();
     Client clientProxy = ClientProxy.getClient(client);
          HTTPConduit conduit = (HTTPConduit) clientProxy.getConduit();
          HTTPClientPolicy policy = new HTTPClientPolicy();
          policy.setConnectionTimeout(200000000);
          policy.setReceiveTimeout(10000000);
          conduit.setClient(policy);

但仍然会收到Socket Time Out Exception

SEVERE: Servlet.service() for servlet CXFServlet threw exception
java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:740)
        at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
        at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:349)
        at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:764)
        at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:126)
        at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:573)
        at org.apache.coyote.Response.doWrite(Response.java:560)
        at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353)
        at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
        at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:349)
        at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381)
        at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370)
        at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
        at com.ctc.wstx.io.UTF8Writer.write(UTF8Writer.java:139)
        at com.ctc.wstx.sw.BufferingXmlWriter.flushBuffer(BufferingXmlWriter.java:1103)
        at com.ctc.wstx.sw.BufferingXmlWriter.fastWriteRaw(BufferingXmlWriter.java:1149)
        at com.ctc.wstx.sw.BufferingXmlWriter.writeEndTag(BufferingXmlWriter.java:803)
        at com.ctc.wstx.sw.BaseNsStreamWriter.doWriteEndTag(BaseNsStreamWriter.java:669)
        at com.ctc.wstx.sw.BaseNsStreamWriter.writeEndElement(BaseNsStreamWriter.java:282)
        at org.apache.cxf.staxutils.StaxUtils.writeElement(StaxUtils.java:633)
        at org.apache.cxf.staxutils.StaxUtils.writeElement(StaxUtils.java:525)
        at org.apache.cxf.staxutils.StaxUtils.writeNode(StaxUtils.java:642)
        at org.apache.cxf.staxutils.StaxUtils.writeElement(StaxUtils.java:628)
        at org.apache.cxf.staxutils.StaxUtils.writeElement(StaxUtils.java:525)
        at org.apache.cxf.staxutils.StaxUtils.writeNode(StaxUtils.java:642)
        at org.apache.cxf.staxutils.StaxUtils.writeElement(StaxUtils.java:628)
        at org.apache.cxf.staxutils.StaxUtils.writeElement(StaxUtils.java:525)
        at org.apache.cxf.staxutils.StaxUtils.writeNode(StaxUtils.java:642)
        at org.apache.cxf.staxutils.StaxUtils.writeElement(StaxUtils.java:628)
        at org.apache.cxf.staxutils.StaxUtils.writeElement(StaxUtils.java:525)

我从Web服务调用其他Web服务作为方法调用的方式(而不是使用JaxWsProxyFactoryBean) 这会是一个问题??

1 个答案:

答案 0 :(得分:0)

java.net.SocketException: Broken pipe

这不是超时异常。这基本上说服务器由于某种原因关闭了连接,我们无法再写入套接字。您可能需要检查服务器端日志以找出原因。