我試圖檢索使用駱駝FTP組件文件(駱駝2.19.0):Apache的駱駝FTP越來越無法檢索文件:參數】remotefile錯誤
from("ftp://my.host.com:21/my/relative/directory?download=true&stepwise=false&delete=false")
駱駝是連接和正確的目錄列表中的文件,但是當它去處理它們,它會因每個文件以下異常:
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot retrieve file: RemoteFile[my/relative/directory/file1.txt] from: ftp://my.host.com:21/my/relative/directory?delete=false&download=true&stepwise=false
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:427)
at org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:137)
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:218)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:182)
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
從跟蹤日誌,我可以看到駱駝是正確列出該目錄中的文件:
[TRACE] 2017-09-05 11:40:49,438 org.apache.camel.component.file.remote.FtpConsumer - Polling directory: my/relative/directory
[TRACE] 2017-09-05 11:40:51,748 org.apache.camel.component.file.remote.FtpOperations - listFiles(my/relative/directory)
[TRACE] 2017-09-05 11:40:58,657 org.apache.camel.component.file.remote.FtpConsumer - Found 3 in directory: my/relative/directory
[TRACE] 2017-09-05 11:40:58,657 org.apache.camel.component.file.remote.FtpConsumer - FtpFile[name=/absolute/path/to/directory/file1.txt, dir=false, file=true]
[TRACE] 2017-09-05 11:40:58,657 org.apache.camel.component.file.remote.FtpConsumer - FtpFile[name=/absolute/path/to/directory/file2.txt, dir=false, file=true]
[TRACE] 2017-09-05 11:40:58,657 org.apache.camel.component.file.remote.FtpConsumer - FtpFile[name=/absolute/path/to/directory/file3.txt, dir=false, file=true]
當駱駝試圖然而來處理每個文件,這似乎是前面加上相對目錄到絕對目錄和沒有找到所得到的亂碼路徑:
[TRACE] 2017-09-05 11:40:59,417 org.apache.camel.component.file.remote.FtpConsumer - Processing file: RemoteFile[absolute/path/to/directory/file1.txt]
[TRACE] 2017-09-05 11:40:59,418 org.apache.camel.component.file.remote.FtpConsumer - Retrieving file: my/relative/directory//absolute/path/to/directory/file1.txt from: ftp://my.host.com:21/my/relative/directory?delete=false&download=true&stepwise=false
[TRACE] 2017-09-05 11:40:59,418 org.apache.camel.component.file.remote.FtpOperations - retrieveFile(my/relative/directory//absolute/path/to/directory/file1.txt)
[TRACE] 2017-09-05 11:40:59,418 org.apache.camel.component.file.remote.FtpOperations - Client retrieveFile: my/relative/directory//absolute/path/to/directory/file1.txt
[WARN ] 2017-09-05 11:40:59,518 org.apache.camel.component.file.remote.FtpConsumer - Error processing file RemoteFile[absolute/path/to/directory/file1.txt] due to Cannot retrieve file: RemoteFile[absolute/path/to/directory/file1.txt] from: ftp://my.host.com:21/my/relative/directory?delete=false&download=true&stepwise=false
由FTPComponent構成該路徑在日誌中不正確:
檢索文件: 我/相對/目錄//絕對/路徑/到/目錄/ FILE1.TXT
我調試的駱駝FTP消費者,它看起來像on line 238 is where the relative path is getting prepended to the absolute path
有趣的是,the SFTP component is doing the same thing但它是工作,因爲RemoteFileOperations<ChannelSftp.LsEntry>
不設置文件名作爲絕對路徑,但RemoteFileOperations<FTPFile>
一樣。
有沒有人有任何建議來解決這個問題,讓FTP Conponent消耗這些文件?還是我做錯了什麼?
我用駱駝2.19.0
嗨,對不起,這不能解決我的問題。問題不在於相對或絕對路徑是否工作 - 與Camel FTP組件無關(但SFTP確實可行)。 –