Ignoring permissions errors on File (FTP/SFTP) consumers

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Ignoring permissions errors on File (FTP/SFTP) consumers

Scott Parkerson-4
Supposing I had a route that consumed from a remote directory via SFTP.
When files are dropped into this directory, they are usually the wrong
permission until a cron job comes by to "fix" the permissions so that they
are readable by the Camel file consumer.

However, until the permissions are set correctly, the file consumer
generates a nasty stacktrace in the logs that looks like this when it
attempts to read a file it has no permission to read:

org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
retrieve file: somefile.txt
        at
org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:532)[214:org.apache.camel.camel-ftp:2.10.0.redhat-60024]
        at
org.apache.camel.component.file.remote.SftpOperations.retrieveFile(SftpOperations.java:494)[214:org.apache.camel.camel-ftp:2.10.0.redhat-60024]
        at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:317)[106:org.apache.camel.camel-core:2.10.0.redhat-60024]
        at
org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:92)[214:org.apache.camel.camel-ftp:2.10.0.redhat-60024]
        at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:189)[106:org.apache.camel.camel-core:2.10.0.redhat-60024]
        at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:155)[106:org.apache.camel.camel-core:2.10.0.redhat-60024]
        at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:142)[106:org.apache.camel.camel-core:2.10.0.redhat-60024]
        at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)[106:org.apache.camel.camel-core:2.10.0.redhat-60024]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source)[:1.6.0_30]
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown
Source)[:1.6.0_30]
        at java.util.concurrent.FutureTask.runAndReset(Unknown
Source)[:1.6.0_30]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
Source)[:1.6.0_30]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
Source)[:1.6.0_30]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
Source)[:1.6.0_30]
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)[:1.6.0_30]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)[:1.6.0_30]
        at java.lang.Thread.run(Unknown Source)[:1.6.0_30]
Caused by: 3: Permission denied
        at
com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2569)[60:org.apache.servicemix.bundles.jsch:0.1.48.1]
        at
com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:1205)[60:org.apache.servicemix.bundles.jsch:0.1.48.1]
        at
com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:1158)[60:org.apache.servicemix.bundles.jsch:0.1.48.1]
        at
org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:525)[214:org.apache.camel.camel-ftp:2.10.0.redhat-60024]
        ... 16 more


Is there a way to neuter this particular warning either by some routing
magic or policy changes?

--sgp
Reply | Threaded
Open this post in threaded view
|

Re: Ignoring permissions errors on File (FTP/SFTP) consumers

Claus Ibsen-2
Hi

Yeah we have a new ignoreFileNotFound option. We could add logic to
allow this option to ignore file permission errors as well for SFTP.
As for regular FTP error code 550 is kinda file not found and
permission error at the same time. Then you can turn this option on
and avoid the stacktraces.



On Thu, Sep 12, 2013 at 4:57 PM, Scott Parkerson <[hidden email]> wrote:

> Supposing I had a route that consumed from a remote directory via SFTP.
> When files are dropped into this directory, they are usually the wrong
> permission until a cron job comes by to "fix" the permissions so that they
> are readable by the Camel file consumer.
>
> However, until the permissions are set correctly, the file consumer
> generates a nasty stacktrace in the logs that looks like this when it
> attempts to read a file it has no permission to read:
>
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> retrieve file: somefile.txt
>         at
> org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:532)[214:org.apache.camel.camel-ftp:2.10.0.redhat-60024]
>         at
> org.apache.camel.component.file.remote.SftpOperations.retrieveFile(SftpOperations.java:494)[214:org.apache.camel.camel-ftp:2.10.0.redhat-60024]
>         at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:317)[106:org.apache.camel.camel-core:2.10.0.redhat-60024]
>         at
> org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:92)[214:org.apache.camel.camel-ftp:2.10.0.redhat-60024]
>         at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:189)[106:org.apache.camel.camel-core:2.10.0.redhat-60024]
>         at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:155)[106:org.apache.camel.camel-core:2.10.0.redhat-60024]
>         at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:142)[106:org.apache.camel.camel-core:2.10.0.redhat-60024]
>         at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)[106:org.apache.camel.camel-core:2.10.0.redhat-60024]
>         at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
> Source)[:1.6.0_30]
>         at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown
> Source)[:1.6.0_30]
>         at java.util.concurrent.FutureTask.runAndReset(Unknown
> Source)[:1.6.0_30]
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
> Source)[:1.6.0_30]
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
> Source)[:1.6.0_30]
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
> Source)[:1.6.0_30]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
> Source)[:1.6.0_30]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
> Source)[:1.6.0_30]
>         at java.lang.Thread.run(Unknown Source)[:1.6.0_30]
> Caused by: 3: Permission denied
>         at
> com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2569)[60:org.apache.servicemix.bundles.jsch:0.1.48.1]
>         at
> com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:1205)[60:org.apache.servicemix.bundles.jsch:0.1.48.1]
>         at
> com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:1158)[60:org.apache.servicemix.bundles.jsch:0.1.48.1]
>         at
> org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:525)[214:org.apache.camel.camel-ftp:2.10.0.redhat-60024]
>         ... 16 more
>
>
> Is there a way to neuter this particular warning either by some routing
> magic or policy changes?
>
> --sgp



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen