You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by shreyas <sh...@hotmail.com> on 2015/01/21 00:42:21 UTC

SFTP exclude un-readable directory

Hello,

I am using the SFTP component to recursively scan directories to read files. The server creates some unix "lost+found" directories with root permission. I want to exclude scanning this directory as it results in permission errors. I have tried:
antExclude=**/lost+found/** 
ignoreFileNotFoundOrPermissionError=true

My other options set on the component are:
delete=true
recursive=true
stepwise=false

I had to use stepwise=false as it was failing on reading "." and ".." directories.

A small stack trace if it helps is below. Though this is a warning, the SFTP component fails and restarts with a login to remote server. Any help would be appreciated. Thanks.

org.apache.camel.component.file.GenericFileOperationFailedException: Cannot list directory: /inbox/lost+found
	at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:583) ~[camel-ftp-2.14.1.jar:2.14.1]
	at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:90) ~[camel-ftp-2.14.1.jar:2.14.1]
	at org.apache.camel.component.file.remote.SftpConsumer.pollSubDirectory(SftpConsumer.java:61) ~[camel-ftp-2.14.1.jar:2.14.1]
	at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:118) ~[camel-ftp-2.14.1.jar:2.14.1]
	at org.apache.camel.component.file.remote.SftpConsumer.pollSubDirectory(SftpConsumer.java:61) ~[camel-ftp-2.14.1.jar:2.14.1]
	at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:118) ~[camel-ftp-2.14.1.jar:2.14.1]
	at org.apache.camel.component.file.remote.SftpConsumer.pollDirectory(SftpConsumer.java:52) ~[camel-ftp-2.14.1.jar:2.14.1]
	at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:119) ~[camel-core-2.15-SNAPSHOT.jar:2.15-SNAPSHOT]
	at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187) [camel-core-2.15-SNAPSHOT.jar:2.15-SNAPSHOT]
	at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114) [camel-core-2.15-SNAPSHOT.jar:2.15-SNAPSHOT]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_60]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [na:1.7.0_60]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_60]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.7.0_60]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_60]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_60]
	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_60]
Caused by: com.jcraft.jsch.SftpException: Permission denied
       at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846) ~[jsch-0.1.51.jar:na]
	at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1606) ~[jsch-0.1.51.jar:na]
	at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1526) ~[jsch-0.1.51.jar:na]

..Shreyas.. 		 	   		  

Re: SFTP exclude un-readable directory

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Just for people finding this thread later. A ticket was logged and
Shreyas provided a patch
https://issues.apache.org/jira/browse/CAMEL-8266?

On Wed, Jan 21, 2015 at 12:42 AM, shreyas <sh...@hotmail.com> wrote:
> Hello,
>
> I am using the SFTP component to recursively scan directories to read files. The server creates some unix "lost+found" directories with root permission. I want to exclude scanning this directory as it results in permission errors. I have tried:
> antExclude=**/lost+found/**
> ignoreFileNotFoundOrPermissionError=true
>
> My other options set on the component are:
> delete=true
> recursive=true
> stepwise=false
>
> I had to use stepwise=false as it was failing on reading "." and ".." directories.
>
> A small stack trace if it helps is below. Though this is a warning, the SFTP component fails and restarts with a login to remote server. Any help would be appreciated. Thanks.
>
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot list directory: /inbox/lost+found
>         at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:583) ~[camel-ftp-2.14.1.jar:2.14.1]
>         at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:90) ~[camel-ftp-2.14.1.jar:2.14.1]
>         at org.apache.camel.component.file.remote.SftpConsumer.pollSubDirectory(SftpConsumer.java:61) ~[camel-ftp-2.14.1.jar:2.14.1]
>         at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:118) ~[camel-ftp-2.14.1.jar:2.14.1]
>         at org.apache.camel.component.file.remote.SftpConsumer.pollSubDirectory(SftpConsumer.java:61) ~[camel-ftp-2.14.1.jar:2.14.1]
>         at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:118) ~[camel-ftp-2.14.1.jar:2.14.1]
>         at org.apache.camel.component.file.remote.SftpConsumer.pollDirectory(SftpConsumer.java:52) ~[camel-ftp-2.14.1.jar:2.14.1]
>         at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:119) ~[camel-core-2.15-SNAPSHOT.jar:2.15-SNAPSHOT]
>         at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187) [camel-core-2.15-SNAPSHOT.jar:2.15-SNAPSHOT]
>         at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114) [camel-core-2.15-SNAPSHOT.jar:2.15-SNAPSHOT]
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_60]
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [na:1.7.0_60]
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_60]
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.7.0_60]
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_60]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_60]
>         at java.lang.Thread.run(Thread.java:745) [na:1.7.0_60]
> Caused by: com.jcraft.jsch.SftpException: Permission denied
>        at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846) ~[jsch-0.1.51.jar:na]
>         at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1606) ~[jsch-0.1.51.jar:na]
>         at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1526) ~[jsch-0.1.51.jar:na]
>
> ..Shreyas..



-- 
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
hawtio: http://hawt.io/
fabric8: http://fabric8.io/