osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

File2 error during commit, how can I handle the exception?


Using the File2 component (2.19.5), I'm provoking a situation with the "move" folder no longer being writable.
This causes the following exception to occur and logged during the "commit" phase.
And then, with every consumer poll, the same file is being imported again and again!
Not a good situation...  consumer.bridgeErrorHandler is true, but the configured route exception handler is not called.

2018-05-20 11:48:55,586 | WARN  | path/file_import | GenericFileOnCompletion          | rg.apache.camel.util.CamelLogger  213 | 140 - org.apache.camel.camel-core - 2.19.5 | Error during commit. Exchange[ID-deimos3-33293-1526808185820-5-986]. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Error renaming file from /path/file_import/msg1 to /path/file_import/done/msg1-2018-05-20T11:48:53.585]
org.apache.camel.component.file.GenericFileOperationFailedException: Error renaming file from /path/file_import/msg1 to /path/file_import/done/msg1-2018-05-20T11:48:53.585
        at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:81)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:113)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:110)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:127)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:83)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:57)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:104)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:234)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.util.UnitOfWorkHelper.doneUow(UnitOfWorkHelper.java:65)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:675)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:630)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:247)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:258)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:120)[144:org.apache.camel.camel-spring:2.19.5]
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:452)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:219)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:183)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)[140:org.apache.camel.camel-core:2.19.5]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_144]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_144]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_144]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_144]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_144]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_144]
        at java.lang.Thread.run(Thread.java:748)[:1.8.0_144]
Caused by: java.io.FileNotFoundException: /path/file_import/done/msg1-2018-05-20T11:48:53.585 (Permission denied)
        at java.io.FileOutputStream.open0(Native Method)[:1.8.0_144]
        at java.io.FileOutputStream.open(FileOutputStream.java:270)[:1.8.0_144]
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)[:1.8.0_144]
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)[:1.8.0_144]
        at org.apache.camel.util.FileUtil.copyFile(FileUtil.java:537)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.util.FileUtil.renameFileUsingCopy(FileUtil.java:517)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:491)[140:org.apache.camel.camel-core:2.19.5]
        at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:78)[140:org.apache.camel.camel-core:2.19.5]
        ... 27 more

I was hoping the exception handler is called so I can stop the route in this situation.