Sandeep,
Can you pinpoint the messages that are causing this error? Is there
anything special to them? BTW, I see you are using the Camel dead
letter channel. Make sure you configure that properly (not related to
your current question, but the default configuration just writes a
message to the log when things go wrong without information the JBI
endpoint).
Regards,
Gert
sandeep reddy wrote:
Hi Servicemix-guys,
Following is the my use case message flow:
Client App <--> HTTPConsumerSu --> CamelSu <---> HTTPProviderSu
<--> External App
We are struggling with a problem having INFO level in log4j.xml for
org.apache.servicemix logger and WARN levels for rest of all loggers.
Problem was java.io.IOException: Stream closed. The message was not
delivered to External App. Following is the link for forum discussion :
http://cwiki.apache.org/SM/discussion-forums.html#nabble-td18688010
The error is related to
http://cwiki.apache.org/SM/javaioioexception-stream-closed.html and is
occurring for us in ServiceMix-Camel component.
It finally got resolved based on suggestion mentioned in the forum.
But this time I am facing error after getting response from External
application. The error log is:
com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream.
at
com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:548)
at
com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:604)
at
com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:660)
at
com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:331)
at
org.apache.servicemix.jbi.jaxp.StAXSourceTransformer.toXMLStreamReader(StAXSourceTransformer.java:86)
at
org.apache.servicemix.http.endpoints.DefaultHttpConsumerMarshaler.sendOut(DefaultHttpConsumerMarshaler.java:78)
at
org.apache.servicemix.http.endpoints.HttpConsumerEndpoint.sendOut(HttpConsumerEndpoint.java:392)
at
org.apache.servicemix.http.endpoints.HttpConsumerEndpoint.process(HttpConsumerEndpoint.java:273)
at
org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
To solve the above problem I tried same way as Gert suggested having
convertToBody(DOMSource.class) after to(.......) statement.
Camel configuration with the added changes is as follows :
from("jbi:service:http://servicemix.in2m.com/operations/changepassword/RoutingService")
.convertBodyTo(DOMSource.class) //added here
.choice()
.when(header("userPrincipals").contains("director"))
.to("jbi:service:http://servicemix.in2m.com/operations/changepassword/PortalService?mep=in-out")
.convertBodyTo(DOMSource.class) //added here
.when(header("userPrincipals").contains("portal"))
.to("jbi:service:http://servicemix.in2m.com/operations/changepassword/DirectorService?mep=in-out")
.convertBodyTo(DOMSource.class); //added here
After the above changes almost all working, but some times I am getting
following exception:
ERROR - DeadLetterChannel - Failed delivery forexchangeId:
ID-rsandeep/34384-1218012001777/0-0. On delivery attempt: 0 caught:
org.apache.camel.RuntimeCamelException: java.io.IOException:Attempted read
on closed stream.
org.apache.camel.RuntimeCamelException: java.io.IOException: Attempted read
on closed stream.
at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:411)
at
org.apache.camel.impl.converter.InstanceMethodTypeConverter.convertTo(InstanceMethodTypeConverter.java:50)
at
org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:67)
at
org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:59)
at
org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:50)
at
org.apache.camel.processor.ConvertBodyProcessor.process(ConvertBodyProcessor.java:41)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
at
org.apache.servicemix.camel.CamelJbiEndpoint.handleActiveProviderExchange(CamelJbiEndpoint.java:101)
at
org.apache.servicemix.camel.CamelJbiEndpoint.process(CamelJbiEndpoint.java:74)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.IOException: Attempted read on closed stream.
at
org.apache.commons.httpclient.AutoCloseInputStream.isReadAllowed(AutoCloseInputStream.java:165)
at
org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:85)
at
org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(Unknown
Source)
at
org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(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.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at
org.apache.camel.converter.jaxp.XmlConverter.toDOMSourceFromStream(XmlConverter.java:366)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:407)
... 26 more
Please help me resolve this problem. This is acting as a blocker as we
cannot release with the DEBUG mode in log4j.xml
Sandeep.