2013-12-13 67 views
2

我在通過SFTP獲取大文件並嘗試使用readLock。當試圖獲得1G文件(一個大型文件需要很多秒才能複製)時,我得到以下異常。順便說一句,當我嘗試1M的順序的小文件時,SFTP工作正常。GenericFileOperationFailedException:無法將目錄更改爲:.. - 嘗試使用SFTP 1G文件

這是駱駝2.12.1中的一個錯誤還是我做錯了什麼?

2013-12-13 14:30:12,964 [alhost/outbound] INFO SftpConsumer     - Connected and logged in to: sftp://[email protected]:22 
2013-12-13 14:30:19,893 [alhost/outbound] WARN SftpConsumer     - Error processing file RemoteFile[Centos5.7-64-Base-GS-Image-UI.ova] due to Cannot change directory to: ... Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot change directory to: ..] 
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot change directory to: .. 
    at org.apache.camel.component.file.remote.SftpOperations.doChangeDirectory(SftpOperations.java:542) 
    at org.apache.camel.component.file.remote.SftpOperations.changeCurrentDirectory(SftpOperations.java:530) 
    at org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:656) 
    at org.apache.camel.component.file.remote.SftpOperations.retrieveFile(SftpOperations.java:594) 
    at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:362) 
    at org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:99) 
    at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:201) 
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:165) 
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187) 
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) 

我的路線如下所示:

from("sftp://[email protected]/outbound?password=xxx&delete=true&readLock=changed&delay=10000&readLockCheckInterval=3000") 
     .to("file:///home/cps/camel/input?flatten=true"); 

回答

4

一些google搜索後,我發現了一個建議逐步添加= FALSE,以防止上面看到的例外。在設置stepwise = false之後,我得到了OutOfMemory異常,並且還添加了streamDownload = true。下面的路由現在將sftp我的大文件,我已經證明,readlocks的工作原理是因爲我驗證了當我將大文件複製到SFTP目錄時SFTP沒有開始。

from("sftp://[email protected]/outbound?streamDownload=true&stepwise=false&password=xxx&delete=true&readLock=changed&delay=5000&readLockCheckInterval=2000") 
     .to("file:///home/cps/camel/input?flatten=true"); 
相關問題