2012-09-21 81 views
0

我與駱駝工作,我想一個Smooks轉換添加到我的路線:駱駝:Smooks的過濾操作失敗

public void configure() throws Exception { 
    from("file:src/main/resources/smookFromCsvToXml/from?fileName=test.jtl") 
     .log("Before SmooksComponent\n${body}") 
     .to("smooks://smooks-config.xml") 
     .to("file:src/main/resources/smookFromCsvToXml/to") 
     .log("After SmooksComponent\n${body}"); 
} 

,當我跑這條路線我得到以下錯誤

[sources/smookFromCsvToXml/from] route1       INFO Before SmooksComponent 
Tom,Fennelly,Male,4,Ireland 
Mike,Fennelly,Male,2,Ireland 
[sources/smookFromCsvToXml/from] DefaultErrorHandler   ERROR Failed delivery for (MessageId: ID-WM-WAMS-DAD-61818-1348228740355-0-15 on ExchangeId: ID-WM-WAMS-DAD-61818-1348228740355-0-14). Exhausted after delivery attempt: 1 caught: org.milyn.SmooksException: Smooks Filtering operation failed. 
org.milyn.SmooksException: Smooks Filtering operation failed. 
    at org.milyn.Smooks._filter(Smooks.java:548)[milyn-smooks-all-1.5.1.jar:] 
    at org.milyn.Smooks.filterSource(Smooks.java:482)[milyn-smooks-all-1.5.1.jar:] 
    at org.milyn.smooks.camel.processor.SmooksProcessor.process(SmooksProcessor.java:107)[milyn-smooks-all-1.5.1.jar:] 
    at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:120)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:292)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:115)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.fabric.FabricTraceProcessor.process(FabricTraceProcessor.java:81)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:304)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:50)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:388)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:198)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:159)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:140)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)[camel-core-2.9.0.fuse-70-084.jar:2.9.0.fuse-70-084] 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_25] 
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)[:1.6.0_25] 
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)[:1.6.0_25] 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)[:1.6.0_25] 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)[:1.6.0_25] 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)[:1.6.0_25] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_25] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_25] 
    at java.lang.Thread.run(Thread.java:662)[:1.6.0_25] 
[sources/smookFromCsvToXml/from] GenericFileOnCompletion  WARN Rollback file strategy: org.apache[email protected]1a779dce for file: GenericFile[test.jtl] 

雖然我的改造,如果執行以下操作:

<smooks-resource-list 
    xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" 
    xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.4.xsd" 
    xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd"> 

    <csv:reader fields="firstname,lastname,gender,age,country" rootElementName="people" recordElementName="person" /> 

    <core:exports> 
     <core:result type="org.milyn.payload.StringResult"/> 
    </core:exports> 

</smooks-resource-list> 

它的接縫的Smooks無法讀取輸入的混亂年齡。任何幫助?

回答

1

您可以將信息轉換爲String事先也許,如添加的Smooks

<convertBodyTo type="String"/> 
+0

確定這工作,但就是危險的情況下,我處理大文件之前? – ddelizia

+0

然後你知道它的一個問題,它不能與開箱即用的Camel文件端點一起使用。 –

+0

您可以改爲轉換爲java.io.InputStream –