1 Reply Latest reply on Feb 1, 2012 9:24 PM by Freeman(Yue) Fang

    Stream Closed IOException in CXF Provider

    Tim Gates Newbie

      Hello All,

      Thanks in advance for any help you can supply.

       

      We are developing a system using ServiceMix 3.4.0.5 and are experiencing issues using the servicemix-cxf-bc-2009.01.0.5 as a provider to an external web service.

       

      Version Details:

      - Using ServiceMix / Fuse ESB 3.4.0.5 

      - Using servicemix-cxf-bc version 2009.01.0.6-fuse (Appears to uses CXF 2.2.6-fuse-01-00 internally)

      - We've tested on Windows XP, Windows 7 64, and AIX with the same results.

       

      The Problem

      We have a cxf bc provider trying to communicate with an external web service.  Most of the time this works.  However, if the external web service stops we receive a warning with a Stream Closed exception when attempting to send a message to the service.  Simply restarting the external web service will not restore communication between the external web service and the provider.  In our experience this error can be resolved most of the time by restarting ServiceMix.  Also, we?ve seen instances where restarting ServiceMix does not resolve the Stream Closed exception.  The exception is shown in the Stack Trace at the bottom of this post.

       

       

      Reproducing the symptoms:

      Here are the steps we have used to recreate the problem internally.  We have created a mock web service using SoapUI.  And have a service assembly with a servicemix-cxf-bc provider sending messages to the SoapUI mock web service.

       

      To test:

      - Start SoapUI mock service.

      - Start Servicemix with the cxf provider

      - Send a test message

      - Should successfully process.

      - Then shutdown the SoapUI mock service.

      - Send test message again.

      - Processing will fail with an underlying stream closed exception.

       

      - Restart the SoapUI web service.

      - Send test message again.

      - Message fails with same exception even tho the mock service is running.

       

      The only known way to recover from this situation is to restart SMX.  However, we?ve seen instances where the restart of ServiceMix doesn?t fix the stream closed exception.

       

      Is there any way to reconnect the communication between a CXF Provider and an external web service without restarting ServiceMix?

       

      Let me know if I can supply any other information.

       

      Thanks

      Tim

       

      STACK TRACE:

      2012-01-17 15:34:02:573 GMT-0500, DEBUG, pool-flow.seda.servicemix-cxf-bc-thread-3, org.apache.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on interceptor org.apache.servicemix.cxfbc.interceptors.JbiOutInterceptor@5680568

      2012-01-17 15:34:02:580 GMT-0500, WARN , pool-flow.seda.servicemix-cxf-bc-thread-3, org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for AppointmentWebService has thrown exception, unwinding now

      org.apache.cxf.interceptor.Fault: java.io.IOException: Stream closed

           at org.apache.servicemix.cxfbc.interceptors.JbiOutInterceptor.extractHeaderFromMessagePart(JbiOutInterceptor.java:84)

           at org.apache.servicemix.cxfbc.interceptors.JbiOutInterceptor.handleMessage(JbiOutInterceptor.java:71)

           at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)

           at org.apache.servicemix.cxfbc.CxfBcProvider.process(CxfBcProvider.java:244)

           at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)

           at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)

           at org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:535)

           at org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)

           at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:632)

           at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:185)

           at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)

           at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)

           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)

           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)

           at java.lang.Thread.run(Thread.java:736)

      Caused by:

      javax.xml.transform.TransformerException: java.io.IOException: Stream closed

           at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Unknown Source)

           at org.apache.servicemix.jbi.jaxp.SourceTransformer.toResult(SourceTransformer.java:135)

           at org.apache.servicemix.jbi.jaxp.SourceTransformer.toResult(SourceTransformer.java:113)

           at org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNodeFromSAX(SourceTransformer.java:311)

           at org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromSAX(SourceTransformer.java:306)

           at org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:183)

           at org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:323)

           at org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMElement(SourceTransformer.java:373)

           at org.apache.servicemix.cxfbc.interceptors.JbiOutInterceptor.extractHeaderFromMessagePart(JbiOutInterceptor.java:82)

           ... 14 more

      Caused by:

      java.io.IOException: Stream closed

           at java.io.StringReader.ensureOpen(StringReader.java:50)

           at java.io.StringReader.read(StringReader.java:84)

           at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)

           at org.apache.xerces.impl.XMLEntityScanner.skipString(Unknown Source)

           at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)

           at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

           at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

           at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

           at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

           ... 23 more