Does camel SFTP component support absolute path ?

Solution Verified - Updated -

Issue

  • User has a camel route which writes a file to an SFTP server, renaming any existing file.
  • It uses an absolute path to the target directory.
  • It seems to work fine when there is no existing file.
  • It fails when it attempts to rename the existing file.
  • Endpoint is defined like
sftp://server//absolute/path/to/dir?
  autoCreate=false&
  disconnect=true&
  fileExist=Move&
  knownHostsFile=KNOWN_HOSTS&
  maximumReconnectAttempts=0&
  moveExisting=%24%7Bfile%3Aname.noext%7D-%24%7Bdate%3Anow%3AyyyyMMdd-HHmmssSSS%7D.%24%7Bfile%3Aext%7D&
  privateKeyFile=PRIVATE_KEY_FILE&
  stepwise=false&
  strictHostKeyChecking=true&
  throwExceptionOnConnectFailed=true&
  username=USERNAME
  • The unescaped moveExisting value is
  ${file:name.noext}-${date:now:yyyyMMdd-HHmmssSSS}.${file:ext}
  • User face following error when using this endpoint
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot rename file from: /absolute/path/to/dir/filename.ext to: absolute/path/to/dir/filename-20150602-103603722.ext
    at org.apache.camel.component.file.remote.SftpOperations.renameFile(SftpOperations.java:397)[284:org.apache.camel.camel-ftp:2.12.0.redhat-610379]
    at org.apache.camel.component.file.remote.SftpOperations.doMoveExistingFile(SftpOperations.java:909)[284:org.apache.camel.camel-ftp:2.12.0.redhat-610379]
    at org.apache.camel.component.file.remote.SftpOperations.doStoreFile(SftpOperations.java:811)[284:org.apache.camel.camel-ftp:2.12.0.redhat-610379]
    at org.apache.camel.component.file.remote.SftpOperations.storeFile(SftpOperations.java:784)[284:org.apache.camel.camel-ftp:2.12.0.redhat-610379]
    at org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:278)[280:org.apache.camel.camel-core:2.12.0.redhat-610379]
    at org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:166)[280:org.apache.camel.camel-core:2.12.0.redhat-610379]
    at org.apache.camel.component.file.remote.RemoteFileProducer.process(RemoteFileProducer.java:49)[284:org.apache.camel.camel-ftp:2.12.0.redhat-610379]
    at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[280:org.apache.camel.camel-core:2.12.0.redhat-610379]
    at ...
  • Could it be confirmed if the Camel SFTP component supports absolute path?

Environment

  • Red Hat JBoss Fuse
    • 6.1.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.