我必须从 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
堆栈跟踪
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