On Thu, Jan 15, 2009 at 09:03:44PM +0100, Gert Vanthienen wrote:
> Is there a difference in behavior when DEBUG logging is turned off in  
> ServiceMix?  The Source type being used is different with DEBUG logging  
> on and off so it might make a difference here.

I did a bit more checking this morning.  With DEBUG turned on (for the
org.apache.servicemix package) the following DSL works:

from("activemq:queue.transactionhistory.in")    
  .to("jbi:service:urn:oms:transactionHistory.p1?mep=in-out")
  .convertBodyTo(String.class)
  .to("activemq:queue.transactionhistory.out")
;


However, if I switch logging levels back to WARN for that package, then
without changing anything else, the route fails with:

ERROR - DeadLetterChannel              - Failed delivery for exchangeId:
ID-davisond-laptop/53380-1232099798317/0-0. On delivery attempt: 0
caught: org.apache.camel.RuntimeCamelException:
javax.xml.transform.TransformerException: java.io.IOException: Attempted
read on closed stream.
org.apache.camel.RuntimeCamelException:
javax.xml.transform.TransformerException: java.io.IOException: Attempted
read on closed stream.
        at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:441)
        at
org.apache.camel.impl.converter.InstanceMethodTypeConverter.convertTo(InstanceMethodTypeConverter.java:57)
        at
org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:94)
        at
org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:65)
        at
org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:51)
        at
org.apache.camel.processor.ConvertBodyProcessor.process(ConvertBodyProcessor.java:44)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:75)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:172)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:93)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:115)
        at org.apache.camel.processor.Pipeline.access$200(Pipeline.java:40)
        at org.apache.camel.processor.Pipeline$1.done(Pipeline.java:141)
        at
org.apache.camel.processor.DeadLetterChannel$2.done(DeadLetterChannel.java:184)
        at
org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:69)
        at
org.apache.servicemix.camel.CamelConsumerEndpoint.process(CamelConsumerEndpoint.java:74)
        at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:600)
        at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:571)
        at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:510)
        at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620)
        at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
        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:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.xml.transform.TransformerException:
java.io.IOException: Attempted read on closed stream.
        at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:505)
        at
org.apache.camel.converter.jaxp.XmlConverter.toResult(XmlConverter.java:130)
        at
org.apache.camel.converter.jaxp.XmlConverter.toResult(XmlConverter.java:114)
        at
org.apache.camel.converter.jaxp.XmlConverter.toString(XmlConverter.java:179)
        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:597)
        at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:437)
        ... 25 more
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.AbstractSAXParser.parse(Unknown Source)
        at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
        ... 33 more



At the very least, this is hugely counter-intuituve to anyone not aware
that logging levels can affect program flow.  I can see why it *might*
(if my guess that DEBUG logging causes some re-usable DOMSource to
replace a default StreamSource in order not to consume from the stream
during logging) but I think it should be documented in 3-feet high
letters somewhere if this is normal camel behaviour :)

So, really I'd prefer to have this working without DEBUG logging on -
how do I convert whatever is being used to a String before it goes on my
.out queue?

Many thanks,



-- 
Darren Davison
Public Key: 0xE855B3EA

Attachment: signature.asc
Description: Digital signature

Reply via email to