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+tut
orial-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.co
m/camelRouter"/>
>> <choice>
>> <when>
>> <xpath>//name='Tijs'</xpath>
>> <to uri="jbi:service:http://test.com/my
Camel"/>
>> </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.w
riteMessageContent(DefaultFileMarshaler.java:139)
>> at
>>
org.apache.servicemix.components.util.DefaultFileMarshaler.w
riteMessage(DefaultFileMarshaler.java:76)
>> at
>>
org.apache.servicemix.file.FileSenderEndpoint.processInOnly(
FileSenderEndpoint.java:83)
>> at
>>
org.apache.servicemix.common.endpoints.ProviderEndpoint.proc
ess(ProviderEndpoint.java:100)
>> at
>>
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(As
yncBaseLifeCycle.java:538)
>> at
>>
org.apache.servicemix.common.AsyncBaseLifeCycle.processExcha
nge(AsyncBaseLifeCycle.java:490)
>> at
>>
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange
(BaseLifeCycle.java:46)
>> at
>>
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.proc
essInBound(DeliveryChannelImpl.java:610)
>> at
>>
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(Ab
stractFlow.java:170)
>> at
>>
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(S
edaFlow.java:167)
>> at
>>
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(Seda
Queue.java:134)
>> at
>>
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa
dPoolExecutor.java:650)
>> at
>>
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
lExecutor.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.transfo
rm(TransformerIdentityImpl.java:505)
>> at
>>
org.apache.servicemix.jbi.jaxp.SourceTransformer.toResult(So
urceTransformer.java:111)
>> at
>>
org.apache.servicemix.components.util.DefaultFileMarshaler.w
riteMessageContent(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:18
9)
>> at
java.io.BufferedInputStream.read(BufferedInputStream.java:23
5)
>> at
>>
org.apache.xerces.impl.XMLEntityManager$RewindableInputStrea
m.read(Unknown
>> Source)
>> at
>>
org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(U
nknown
>> Source)
>> at
>>
org.apache.xerces.impl.XMLVersionDetector.determineDocVersio
n(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.transfo
rm(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-express
ion-in-servicemix-camel-component-tf4751607s12049.html#a1358
9052
Sent from the ServiceMix - User mailing list archive at
Nabble.com.
|