2013-02-01 77 views
1

我的路線中有很多轉換,有時由於某些不良格式文件或其他原因導致某些轉換失敗,所以當發生一些異常時,我必須發送一封電子郵件。因此,在上下文中,我宣佈:駱駝 - 捕捉全局例外

<camel:onException useOriginalMessage="true"> 
    <camel:exception>javax.xml.transform.TransformerException</camel:exception> 
    <camel:redeliveryPolicy maximumRedeliveries="3"/> 
    <camel:to uri="smtp://localhost:[email protected]&amp;[email protected]" /> 
</camel:onException> 

但它就像沒有發生,因爲我的駱駝retring做改造不停止,也不會發送電子郵件。

這是日誌:

2013-02-01 14:55:09,645 | WARN | ox/products_list | GenericFileOnCompletion   | ?         ? | 92 - org.apache.camel.camel-core - 2.8.5 | Rollback file strategy: org.apache[email protected]6fc72332 for file: GenericFile[/opt/servicemix/data/smx-data/outbox/products_list/product_export.xml] 
2013-02-01 14:55:10,238 | ERROR | ox/products_list | DefaultErrorHandler    | ?         ? | 92 - org.apache.camel.camel-core - 2.8.5 | Failed delivery for exchangeId: ID-esb1-prod-prod-thesting-cyso-net-44582-1359563246542-5-1329. Exhausted after delivery attempt: 1 caught: javax.xml.transform.TransformerException: XML document structures must start and end within the same entity. 
javax.xml.transform.TransformerException: XML document structures must start and end within the same entity. 
     at org.apache.xalan.transformer.TransformerImpl.fatalError(TransformerImpl.java:780)[:] 
     at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:756)[:] 
     at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1273)[:] 
     at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1251)[:] 
     at org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:123)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:102)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:72)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:48)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:114)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:284)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:109)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.Pipeline.process(Pipeline.java:116)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.Pipeline.process(Pipeline.java:79)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:111)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:114)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:284)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:109)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:111)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:114)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:284)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:109)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:573)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:506)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:219)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:353)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:176)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:137)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:139)[92:org.apache.camel.camel-core:2.8.5] 
     at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91)[92:org.apache.camel.camel-core:2.8.5] 
     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_26] 
     at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)[:1.6.0_26] 
     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)[:1.6.0_26] 
     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)[:1.6.0_26] 
     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)[:1.6.0_26] 
     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)[:1.6.0_26] 
     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_26] 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_26] 
     at java.lang.Thread.run(Thread.java:662)[:1.6.0_26] 

難道我做錯了什麼?

回答

1

如果轉換失敗,它很可能不會完成下一次 - 數據是錯誤的。所以你的情況的重新交付政策是少一點點。

但是,請嘗試設置要處理的異常,然後設置您的smtp端點。

<camel:handled> 
     <camel:constant>true</camel:constant> 
</camel:handled>