Uploaded image for project: 'FUSE Mediation Router'
  1. FUSE Mediation Router
  2. MR-687

Camel SFTP endpoint throws exception when running camel route on Windows OS

    XMLWordPrintable

Details

    Description

      I have a rather simple camel route involving sftp endpoints:
      from("sftp://jluo@192.168.0.196/outbox?password=****&binary=true&autoCreate=true&move=.done").to("sftp://jluo@192.168.0.196/inbox?password=****&autoCreate=true&binary=true");

      The camel sftp consumer and producer endpoints are pointing to my Mac OSX host (192.168.0.196). When I ran the camel route on Windows machine (here I was using Windows 7 Pro 64-bit OS) to try to use sftp to consume and produce files from/to Mac OSX machine, I got following error:

      16:47:29,408 | INFO | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | JSCH -> SSH_MSG_NEWKEYS sent
      16:47:29,408 | INFO | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | JSCH -> SSH_MSG_NEWKEYS received
      16:47:29,409 | INFO | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | JSCH -> SSH_MSG_SERVICE_REQUEST sent
      16:47:29,409 | INFO | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | JSCH -> SSH_MSG_SERVICE_ACCEPT received
      16:47:29,411 | INFO | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | JSCH -> Authentications that can continue: publickey,keyboard-interactive,password
      16:47:29,411 | INFO | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | JSCH -> Next authentication method: publickey
      16:47:29,411 | INFO | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | JSCH -> Authentications that can continue: keyboard-interactive,password
      16:47:29,411 | INFO | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | JSCH -> Next authentication method: keyboard-interactive
      16:47:29,434 | INFO | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | JSCH -> Authentication succeeded (keyboard-interactive).
      16:47:29,435 | TRACE | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | Channel isn't connected, trying to recreate and connect.
      16:47:29,435 | TRACE | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | Connecting use connectTimeout: 10000 ...
      16:47:29,496 | INFO | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | Connected to sftp://jluo@192.168.0.196:22
      16:47:29,496 | INFO | 168.0.196/outbox | SftpConsumer | 147 - org.apache.camel.camel-core - 2.10.0.fuse-71-047 | Connected and logged in to: sftp://jluo@192.168.0.196:22
      16:47:29,497 | TRACE | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | getCurrentDirectory()
      16:47:29,497 | TRACE | 168.0.196/outbox | SftpConsumer | 147 - org.apache.camel.camel-core - 2.10.0.fuse-71-047 | doPollDirectory from absolutePath: outbox, dirName: null
      16:47:29,497 | TRACE | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | changeCurrentDirectory(outbox)
      16:47:29,497 | TRACE | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | getCurrentDirectory()
      16:47:29,498 | TRACE | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | Changing directory: outbox
      16:47:29,499 | TRACE | 168.0.196/outbox | SftpConsumer | 147 - org.apache.camel.camel-core - 2.10.0.fuse-71-047 | Polling directory: outbox
      16:47:29,499 | TRACE | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | listFiles(.)
      16:47:29,502 | TRACE | 168.0.196/outbox | SftpConsumer | 147 - org.apache.camel.camel-core - 2.10.0.fuse-71-047 | Found 3 in directory: outbox
      16:47:29,502 | TRACE | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | changeCurrentDirectory(/Users/jluo)
      16:47:29,502 | TRACE | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | getCurrentDirectory()
      16:47:29,502 | TRACE | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | Changing directory: \
      16:47:29,503 | WARN | 168.0.196/outbox | eFilePollingConsumerPollStrategy | 147 - org.apache.camel.camel-core - 2.10.0.fuse-71-047 | Trying to recover by disconnecting from remote server forcing a re-connect at next poll: sftp://jluo@192.168.0.196:22
      16:47:29,503 | DEBUG | 168.0.196/outbox | SftpConsumer | 147 - org.apache.camel.camel-core - 2.10.0.fuse-71-047 | Disconnecting from: sftp://jluo@192.168.0.196:22
      16:47:29,503 | INFO | 168.0.196/outbox | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | JSCH -> Disconnecting from 192.168.0.196 port 22
      16:47:29,504 | INFO | 68.0.196 session | SftpOperations | 215 - org.apache.camel.camel-ftp - 2.10.0.fuse-71-047 | JSCH -> Caught an exception, leaving main loop due to socket closed
      16:47:29,505 | WARN | 168.0.196/outbox | SftpConsumer | 147 - org.apache.camel.camel-core - 2.10.0.fuse-71-047 | Consumer Consumer[sftp://jluo@192.168.0.196/outbox?autoCreate=true&binary=true&localWorkDirectory=.%2Fhellp&move=.done&password=******] failed polling endpoint: Endpoint[sftp://jluo@192.168.0.196/outbox?autoCreate=true&binary=true&localWorkDirectory=.%2Fhellp&move=.done&password=******]. Will try again at next poll. 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:434)[215:org.apache.camel.camel-ftp:2.10.0.fuse-71-047]
      at org.apache.camel.component.file.remote.SftpOperations.changeCurrentDirectory(SftpOperations.java:407)[215:org.apache.camel.camel-ftp:2.10.0.fuse-71-047]
      at org.apache.camel.component.file.remote.SftpConsumer.pollDirectory(SftpConsumer.java:52)[215:org.apache.camel.camel-ftp:2.10.0.fuse-71-047]
      at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:107)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
      at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:142)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
      at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_33]
      at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)[:1.6.0_33]
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)[:1.6.0_33]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)[:1.6.0_33]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)[:1.6.0_33]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)[:1.6.0_33]
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_33]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_33]
      at java.lang.Thread.run(Thread.java:662)[:1.6.0_33]
      Caused by: 2: No such file
      at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2297)[59:org.apache.servicemix.bundles.jsch:0.1.44.2]
      at com.jcraft.jsch.ChannelSftp._realpath(ChannelSftp.java:1831)[59:org.apache.servicemix.bundles.jsch:0.1.44.2]
      at com.jcraft.jsch.ChannelSftp.cd(ChannelSftp.java:268)[59:org.apache.servicemix.bundles.jsch:0.1.44.2]
      at org.apache.camel.component.file.remote.SftpOperations.doChangeDirectory(SftpOperations.java:432)[215:org.apache.camel.camel-ftp:2.10.0.fuse-71-047]
      ... 14 more

      I tried to run the same camel route on my Mac OSX host (so it was from Mac OSX -> Mac OSX) and everything worked fine. In another word, running the camel route on an Unix like OS, it worked fine. It looks like a bug was introduced from camel 2.9.x to 2.10 that relates to Windows path since I also tested on 2.9.0-fuse-70-084 version that is shipped with Fuse ESB Enterprise 7.0.1 and when I ran the same route on Windows machine with Fuse ESB Enterprise 7.0.1, it worked fine though.

      Attachments

        Activity

          People

            cibsen@redhat.com Claus Ibsen
            rhn-support-qluo Joe Luo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: