GenericFileOperationFailedException:无法将目录更改为:.. - 尝试SFTP 1G文件时

时间:2013-12-13 21:50:42

标签: apache-camel sftp

我正在玩通过SFTP获取大文件并尝试使用readLocks。当试图获取1G文件(一个大文件需要很长时间才能复制)时,我得到以下异常。顺便说一句,当我尝试一个大约1M的小文件时,SFTP工作正常。

这是Camel 2.12.1中的错误还是我做错了什么?

2013-12-13 14:30:12,964 [alhost/outbound]  INFO SftpConsumer                   - Connected and logged in to: sftp://tdr@localhost: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://tdr@localhost/outbound?password=xxx&delete=true&readLock=changed&delay=10000&readLockCheckInterval=3000")
        .to("file:///home/cps/camel/input?flatten=true");

1 个答案:

答案 0 :(得分:4)

经过一些谷歌搜索,我发现建议添加stepwise = false以防止上面看到的异常。设置stepwise = false后,我得到一个OutOfMemory异常,并添加了streamDownload = true。以下路由现在将sftp我的大文件,并且我已经证明了readlock工作,因为我验证了在将大文件复制到SFTP目录时SFTP没有开始。

from("sftp://tdr@localhost/outbound?streamDownload=true&stepwise=false&password=xxx&delete=true&readLock=changed&delay=5000&readLockCheckInterval=2000")
        .to("file:///home/cps/camel/input?flatten=true");