Hello,

I have route (camel 2.7.1):

<route>
  <from uri="sftp://user@host/folder?password=password&delete=true"; />
  <onException>
     <exception>java.lang.Exception</exception>
     <log message="ERROR receiving file" loggingLevel="ERROR" />
     <rollback/>
  </onException>
  <to uri="activemq:RECEIVED.FILES.QUEUE" />
</route>

If I don't have permissions to delete the remote file, the same file gets
processed and is put to activemq queue over and over again (onException
block doesn't make any sense, it should rollback message from queue). Using
"idempotent=true" may be a workarround, but in my case I need process files
with the same name after some time.

Exception is logged in DEBUG level:

2012-01-02 12:15:48,281 | DEBUG |  | GenericFileOnCompletion          |
ache.camel.processor.CamelLogger | 52 - org.apache.camel.camel-core -
2.7.1.fuse-00-43 | Caused by: [o
rg.apache.camel.component.file.GenericFileOperationFailedException - Cannot
delete file: /folder/file.xml]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
delete file: /folder/file.xml
        at
org.apache.camel.component.file.remote.SftpOperations.deleteFile(SftpOperations.java:258)[115:org.apache.camel.camel-ftp:2.7.1.fuse-00-43]
        at
org.apache.camel.component.file.strategy.GenericFileDeleteProcessStrategy.commit(GenericFileDeleteProcessStrategy.java:63)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:142)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:84)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:60)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:198)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.processor.UnitOfWorkProcessor.doneUow(UnitOfWorkProcessor.java:156)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.processor.UnitOfWorkProcessor.access$000(UnitOfWorkProcessor.java:36)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.processor.UnitOfWorkProcessor$1.done(UnitOfWorkProcessor.java:109)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:275)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:345)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:80)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:330)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:157)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:139)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:88)[52:org.apache.camel.camel-core:2.7.1.fuse-00-43]
        at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_27-ea]
        at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)[:1.6.0_27-ea]
        at
java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)[:1.6.0_27-ea]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)[:1.6.0_27-ea]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)[:1.6.0_27-ea]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)[:1.6.0_27-ea]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_27-ea]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_27-ea]
        at java.lang.Thread.run(Thread.java:662)[:1.6.0_27-ea]
Caused by: 3: Permission denied
        at
com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2297)[117:org.apache.servicemix.bundles.jsch:0.1.44.1]
        at
com.jcraft.jsch.ChannelSftp.rm(ChannelSftp.java:1523)[117:org.apache.servicemix.bundles.jsch:0.1.44.1]
        at
org.apache.camel.component.file.remote.SftpOperations.deleteFile(SftpOperations.java:255)[115:org.apache.camel.camel-ftp:2.7.1.fuse-00-43]
        ... 32 more

                
                
How to catch such exceptions? Why <onException> block doesn't work?

Thanks.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-sftp-endpoint-and-exception-handling-tp5114385p5114385.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to