You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Scott Parkerson <sc...@parkerson.net> on 2013/09/12 16:57:22 UTC

Ignoring permissions errors on File (FTP/SFTP) consumers

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

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

Posted by Claus Ibsen <cl...@gmail.com>.
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 <sc...@parkerson.net> 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: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen