Gert,

Thanks for the quick response!
I have added the conversion to a DOMSource for the Java DSL implementation
and that works.

Tijs


Gert Vanthienen wrote:
> 
> Tijs,
> 
> 
> This is a known problem.  The file poller by default sends its message 
> with a StreamSource message content, which can only be read once.  We 
> are adding a solution for this problem to Apache Camel (auto-converting 
> to a re-readable Source type), but for now you will have to convert the 
> message to e.g. a DOMSource yourself.  You can find an example on how to 
> do this in the Java DSL on 
> http://cwiki.apache.org/confluence/display/SM/Replacing+tutorial-eip-su+with+tutorial-camel.
>   
> I'm not sure if/how it can be done in the XML configuration file though...
> 
> 
> Regards,
> 
> Gert
> 
> Tijs wrote:
>> Hi,
>>
>> I am implementing a simple routing rule with the servicemix-camel
>> component
>> in the ServiceMix 3.2 distribution available for download from the
>> website.
>> I have the following XML configuration:
>>
>> <route>
>>   <from uri="jbi:service:http://test.com/camelRouter"/>
>>   <choice>
>>      <when>                    
>>         <xpath>//name='Tijs'</xpath>                   
>>         <to uri="jbi:service:http://test.com/myCamel"/>
>>      </when>
>>      <otherwise>
>>        <to uri="jbi:service:http://test.com/otherCamel"/>
>>      </otherwise>
>>   </choice>
>> </route>
>>
>> The myCamel and otherCamel services are file sender services. I trigger
>> this
>> router with a file poller service. When I run this example I get the
>> following error message:
>>
>> javax.jbi.messaging.MessagingException:
>> javax.xml.transform.TransformerException: java.io.IOException: Stream
>> closed
>>         at
>> org.apache.servicemix.components.util.DefaultFileMarshaler.writeMessageContent(DefaultFileMarshaler.java:139)
>>         at
>> org.apache.servicemix.components.util.DefaultFileMarshaler.writeMessage(DefaultFileMarshaler.java:76)
>>         at
>> org.apache.servicemix.file.FileSenderEndpoint.processInOnly(FileSenderEndpoint.java:83)
>>         at
>> org.apache.servicemix.common.endpoints.ProviderEndpoint.process(ProviderEndpoint.java:100)
>>         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:170)
>>         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: javax.xml.transform.TransformerException: java.io.IOException:
>> Stream closed
>>         at
>> org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:505)
>>         at
>> org.apache.servicemix.jbi.jaxp.SourceTransformer.toResult(SourceTransformer.java:111)
>>         at
>> org.apache.servicemix.components.util.DefaultFileMarshaler.writeMessageContent(DefaultFileMarshaler.java:137)
>>         ... 13 more
>> Caused by: java.io.IOException: Stream closed
>>         at
>> java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145)
>>         at java.io.BufferedInputStream.fill(BufferedInputStream.java:189)
>>         at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
>>         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)
>>         ... 15 more
>>
>> I also have tried to do the same thing in a Java RouteBuilder, but I get
>> the
>> exact same error message.
>> When I change the xpath expression to a header evaluation it is working,
>> so
>> it must have something to do with the XPath implementation. Are the XPath
>> implementations of ServiceMix 3.2 and Camel 1.2 compatible? Is this a
>> bug?
>>
>> Thanks,
>>
>> Tijs
>>   
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Stream-closed-with-XPath-expression-in-servicemix-camel-component-tf4751607s12049.html#a13589052
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to