from("file:pedidos?delay=5s&noop=true").
log("${id}").
split().
xpath("/pedido/itens/item").
filter().
xpath("/item/formato[text()='EBOOK']").
marshal().xmljson().
log("${body}").
setHeader("CamelFileName", simple("${file:name.noext}.json")).
to("file:saida");
Erro:
ERROR 15:50:01.597 - Failed delivery for (MessageId: ID-DESKTOP-HJSR0LD-52267-1500230999773-0-3 on ExchangeId: ID-DESKTOP-HJSR0LD-52267-1500230999773-0-4). Exhausted after delivery attempt: 1 caught: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-DESKTOP-HJSR0LD-52267-1500230999773-0-4][Message: <item>
<formato>EBOOK</formato>
<quantidade>1</quantidade>
<livro>
<codigo>ARQ</codigo>
<titulo>Introdução à Arquitetura e Design de Software</titulo>
<tituloCurto>Arquitetura Java</tituloCurto>
<nomeAutor>Sergio Lopes, Paulo Silveira, Guilherme Silveira, Nico Steppat, outros</nomeAutor>
<valorEbook>29.90</valorEbook>
<valorImpresso>79.90</valorImpresso>
</livro>
</item>]
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[route1 ] [route1 ] [file://pedidos?delay=5s&noop=true ] [ 191]
[route1 ] [filter1 ] [filter[xpath{XPath: /item/formato[text()='EBOOK']}] ] [ 81]
[route1 ] [marshal1 ] [marshal[org.apache.camel.model.dataformat.XmlJsonDataFormat@55a06fde] ] [ 72]
Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
Id ID-DESKTOP-HJSR0LD-52267-1500230999773-0-4
ExchangePattern InOnly
Headers {breadcrumbId=ID-DESKTOP-HJSR0LD-52267-1500230999773-0-1, CamelFileAbsolute=false, CamelFileAbsolutePath=C:\WorkSpaceEclipse\camel-alura\pedidos\1_pedido.xml, CamelFileContentType=text/xml, CamelFileLastModified=1500229808688, CamelFileLength=911, CamelFileName=1_pedido.xml, CamelFileNameConsumed=1_pedido.xml, CamelFileNameOnly=1_pedido.xml, CamelFileParent=pedidos, CamelFilePath=pedidos\1_pedido.xml, CamelFileRelativePath=1_pedido.xml, CamelRedelivered=false, CamelRedeliveryCounter=0}
BodyType org.apache.xerces.dom.DeferredElementNSImpl
Body <item> <formato>EBOOK</formato> <quantidade>1</quantidade> <livro> <codigo>ARQ</codigo> <titulo>Introdução à Arquitetura e Design de Software</titulo> <tituloCurto>Arquitetura Java</tituloCurto> <nomeAutor>Sergio Lopes, Paulo Silveira, Guilherme Silveira, Nico Steppat, outros</nomeAutor> <valorEbook>29.90</valorEbook> <valorImpresso>79.90</valorImpresso> </livro> </item>
]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-DESKTOP-HJSR0LD-52267-1500230999773-0-4][Message: <item>
<formato>EBOOK</formato>
<quantidade>1</quantidade>
<livro>
<codigo>ARQ</codigo>
<titulo>Introdução à Arquitetura e Design de Software</titulo>
<tituloCurto>Arquitetura Java</tituloCurto>
<nomeAutor>Sergio Lopes, Paulo Silveira, Guilherme Silveira, Nico Steppat, outros</nomeAutor>
<valorEbook>29.90</valorEbook>
<valorImpresso>79.90</valorImpresso>
</livro>
</item>]
at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1658) ~[camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:345) ~[camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:90) ~[camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) ~[camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:57) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:668) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:596) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:237) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.Splitter.process(Splitter.java:104) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:442) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:214) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:178) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.16.0.jar:2.16.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_121]
at java.util.concurrent.FutureTask.runAndReset(Unknown Source) [?:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source) [?:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [?:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_121]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ListOrderedMap
at net.sf.json.JSONObject.<init>(JSONObject.java:1450) ~[json-lib-2.4-jdk15.jar:?]
at net.sf.json.xml.XMLSerializer.processObjectElement(XMLSerializer.java:1054) ~[json-lib-2.4-jdk15.jar:?]
at net.sf.json.xml.XMLSerializer.read(XMLSerializer.java:322) ~[json-lib-2.4-jdk15.jar:?]
at net.sf.json.xml.XMLSerializer.readFromStream(XMLSerializer.java:391) ~[json-lib-2.4-jdk15.jar:?]
at org.apache.camel.dataformat.xmljson.XmlJsonDataFormat.marshal(XmlJsonDataFormat.java:158) ~[camel-xmljson-2.16.0.jar:2.16.0]
at org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:83) ~[camel-core-2.16.0.jar:2.16.0]
... 33 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.map.ListOrderedMap
at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_121]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_121]
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[?:1.8.0_121]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_121]
at net.sf.json.JSONObject.<init>(JSONObject.java:1450) ~[json-lib-2.4-jdk15.jar:?]
at net.sf.json.xml.XMLSerializer.processObjectElement(XMLSerializer.java:1054) ~[json-lib-2.4-jdk15.jar:?]
at net.sf.json.xml.XMLSerializer.read(XMLSerializer.java:322) ~[json-lib-2.4-jdk15.jar:?]
at net.sf.json.xml.XMLSerializer.readFromStream(XMLSerializer.java:391) ~[json-lib-2.4-jdk15.jar:?]
at org.apache.camel.dataformat.xmljson.XmlJsonDataFormat.marshal(XmlJsonDataFormat.java:158) ~[camel-xmljson-2.16.0.jar:2.16.0]
at org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:83) ~[camel-core-2.16.0.jar:2.16.0]
... 33 more