Apache Camel为SFTP连接抛出权限被拒绝

时间:2017-08-03 06:21:45

标签: apache-camel camel-ftp

我必须从SFTP服务器读取文件。但在阅读它时,骆驼会抛出com.jcraft.jsch.SftpException: Permission denied。但我对其中的文件夹和文件具有读写权限。我尝试使用filezilla将文件移动到.done文件夹,它可以正常工作。

路线:

sftp://USERNAME@IP_ADDRESS:PORT/path?password=MY_PASSWORD&move=.done&binary=true&disconnect=true&include=FILENAME_(2\\d{3})(\\d{2})(\\d{2}).txt

File Permissions

堆栈跟踪

o.a.c.c.file.remote.SftpConsumer         : Error processing file RemoteFile[FILENAME_20170802.txt] due to Cannot retrieve file: path/FILENAME_20170802.txt. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot retrieve file: path/FILENAME_20170802.txt]

org.apache.camel.component.file.GenericFileOperationFailedException: Cannot retrieve file: path/FILENAME_20170802.txt
    at org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:704) ~[camel-ftp-2.19.1.jar:2.19.1]
    at org.apache.camel.component.file.remote.SftpOperations.retrieveFile(SftpOperations.java:648) ~[camel-ftp-2.19.1.jar:2.19.1]
    at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:408) [camel-core-2.19.1.jar:2.19.1]
    at org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:137) [camel-ftp-2.19.1.jar:2.19.1]
    at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:218) [camel-core-2.19.1.jar:2.19.1]
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:182) [camel-core-2.19.1.jar:2.19.1]
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.19.1.jar:2.19.1]
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.19.1.jar:2.19.1]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_131]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_131]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_131]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
Caused by: com.jcraft.jsch.SftpException: Permission denied
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873) ~[jsch-0.1.54.jar:na]
    at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2225) ~[jsch-0.1.54.jar:na]
    at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:1318) ~[jsch-0.1.54.jar:na]
    at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:1290) ~[jsch-0.1.54.jar:na]
    at org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:689) ~[camel-ftp-2.19.1.jar:2.19.1]
    ... 14 common frames omitted

1 个答案:

答案 0 :(得分:0)

您提供的目录路径是相对路径,而不是绝对路径。 只是确认这是否是问题。

默认情况下,Camel将转到/ home / {username} /目录。不是" \"根目录。

希望它有所帮助。