SFTP file retrieval does not work

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SFTP file retrieval does not work

viktoria
Hi -
I am trying to get some files from a remote sftp server. It does not give me any exception but does not work either.  
I am using Camel version 2.12.0, with Spring version 3.0.5.
Using an ordinary sftp client (FileZilla) i am able to download the files.

Here is my route (Spring-DSL):

<route id="sftpToJMSRoute">
    <from uri="sftp://host?password=password&amp;username=user&amp;noop=true&amp;recursive=true&amp;idempotent=true&amp;idempotentKey=${file:name}-${file:size}-${file:modified}&amp;idempotentRepository=#fileStore"/>
    <process ref="downloadLogger" />
    <to uri="file://c:/.../?recursive=true" />
</route>

I have tried many combination.  I gave a filename ... nothing worked.  Here is the logfile:
    ...
2013-09-12 10:02:26,890 DEBUG SftpEndpoint:270 - Parameters for Generic file process strategy {readLock=none, fastExistsCheck=false, noop=true, readLockTimeout=20000, readLockLoggingLevel=WARN, readLockMinLength=1, readLockCheckInterval=5000}
2013-09-12 10:02:26,890 DEBUG SftpEndpoint:183 - Using Generic file process strategy: org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@663e480f
2013-09-12 10:02:26,890 TRACE SftpConsumer:50 - prePollCheck on sftp://######@#########:22
2013-09-12 10:02:26,921 TRACE TimerListenerManager:86 - Running scheduled TimerListener task
2013-09-12 10:02:26,921 DEBUG SftpConsumer:152 - Not connected/logged in, connecting to: sftp://######@##########:22
2013-09-12 10:02:26,921 TRACE TimerListenerManager:95 - Invoking onTimer on org.apache.camel.management.mbean.ManagedCamelContext@742ab836
2013-09-12 10:02:26,921 TRACE SftpOperations:111 - Session isn't connected, trying to recreate and connect.
2013-09-12 10:02:26,921 TRACE TimerListenerManager:95 - Invoking onTimer on org.apache.camel.management.mbean.ManagedSuspendableRoute@5e411af2
2013-09-12 10:02:26,953 DEBUG SftpOperations:259 - Using StrickHostKeyChecking: no
2013-09-12 10:02:26,953 TRACE SftpOperations:114 - Connecting use connectTimeout: 10000 ...
2013-09-12 10:02:26,953  INFO SftpOperations:359 - JSCH -> Connecting to #host# port 22
2013-09-12 10:02:26,999  INFO SftpOperations:359 - JSCH -> Connection established
2013-09-12 10:02:27,093  INFO SftpOperations:359 - JSCH -> Remote version string: SSH-2.0-mod_sftp/0.9.7
2013-09-12 10:02:27,093  INFO SftpOperations:359 - JSCH -> Local version string: SSH-2.0-JSCH-0.1.39
2013-09-12 10:02:27,093  INFO SftpOperations:359 - JSCH -> CheckCiphers: aes256-cbc,aes192-cbc,aes128-cbc
2013-09-12 10:02:27,140  INFO SftpOperations:359 - JSCH -> aes256-cbc is not available.
2013-09-12 10:02:27,140  INFO SftpOperations:359 - JSCH -> aes192-cbc is not available.
2013-09-12 10:02:27,140  INFO SftpOperations:359 - JSCH -> SSH_MSG_KEXINIT sent
2013-09-12 10:02:27,140  INFO SftpOperations:359 - JSCH -> SSH_MSG_KEXINIT received
2013-09-12 10:02:27,140  INFO SftpOperations:359 - JSCH -> kex: server->client aes128-cbc hmac-md5 none
2013-09-12 10:02:27,140  INFO SftpOperations:359 - JSCH -> kex: client->server aes128-cbc hmac-md5 none
2013-09-12 10:02:27,155  INFO SftpOperations:359 - JSCH -> SSH_MSG_KEXDH_INIT sent
2013-09-12 10:02:27,155  INFO SftpOperations:359 - JSCH -> expecting SSH_MSG_KEXDH_REPLY
2013-09-12 10:02:27,202  INFO SftpOperations:359 - JSCH -> ssh_rsa_verify: signature true
2013-09-12 10:02:27,218  WARN SftpOperations:356 - JSCH -> Permanently added '#host#' (RSA) to the list of known hosts.
2013-09-12 10:02:27,218  INFO SftpOperations:359 - JSCH -> SSH_MSG_NEWKEYS sent
2013-09-12 10:02:27,249  INFO SftpOperations:359 - JSCH -> SSH_MSG_NEWKEYS received
2013-09-12 10:02:27,249  INFO SftpOperations:359 - JSCH -> SSH_MSG_SERVICE_REQUEST sent
2013-09-12 10:02:27,280  INFO SftpOperations:359 - JSCH -> SSH_MSG_SERVICE_ACCEPT received
2013-09-12 10:02:27,311  INFO SftpOperations:359 - JSCH -> Authentications that can continue: publickey,keyboard-interactive,password
2013-09-12 10:02:27,311  INFO SftpOperations:359 - JSCH -> Next authentication method: publickey
2013-09-12 10:02:27,311  INFO SftpOperations:359 - JSCH -> Authentications that can continue: password
2013-09-12 10:02:27,311  INFO SftpOperations:359 - JSCH -> Next authentication method: password
2013-09-12 10:02:27,374  INFO SftpOperations:359 - JSCH -> Authentication succeeded (password).
2013-09-12 10:02:27,374 TRACE SftpOperations:122 - Channel isn't connected, trying to recreate and connect.
2013-09-12 10:02:27,421 TRACE SftpOperations:126 - Connecting use connectTimeout: 10000 ...
12.09.2013 10:02:27 com.sun.xml.ws.transport.http.servlet.WSServletDelegate <init>
INFO: WSSERVLET14: JAX-WS servlet initializing
2013-09-12 10:02:27,920 TRACE TimerListenerManager:86 - Running scheduled TimerListener task
2013-09-12 10:02:27,920 TRACE TimerListenerManager:95 - Invoking onTimer on org.apache.camel.management.mbean.ManagedCamelContext@742ab836
2013-09-12 10:02:27,920 TRACE TimerListenerManager:95 - Invoking onTimer on org.apache.camel.management.mbean.ManagedSuspendableRoute@5e411af2
2013-09-12 10:02:28,919 TRACE TimerListenerManager:86 - Running scheduled TimerListener task
2013-09-12 10:02:28,919 TRACE TimerListenerManager:95 - Invoking onTimer on org.apache.camel.management.mbean.ManagedCamelContext@742ab836
2013-09-12 10:02:28,919 TRACE TimerListenerManager:95 - Invoking onTimer on org.apache.camel.management.mbean.ManagedSuspendableRoute@5e411af2
2013-09-12 10:02:29,918 TRACE TimerListenerManager:86 - Running scheduled TimerListener task
2013-09-12 10:02:29,918 TRACE TimerListenerManager:95 - Invoking onTimer on org.apache.camel.management.mbean.ManagedCamelContext@742ab836
2013-09-12 10:02:29,918 TRACE TimerListenerManager:95 - Invoking onTimer on org.apache.camel.management.mbean.ManagedSuspendableRoute@5e411af2
2013-09-12 10:02:30,917 TRACE TimerListenerManager:86 - Running scheduled TimerListener task
2013-09-12 10:02:30,917 TRACE TimerListenerManager:95 - Invoking onTimer on org.apache.camel.management.mbean.ManagedCamelContext@742ab836
2013-09-12 10:02:30,917 TRACE TimerListenerManager:95 - Invoking onTimer on org.apache.camel.management.mbean.ManagedSuspendableRoute@5e411af2
    ...

I have tried to route against an other sftp server: Same problem.
The log from the sftp looks like this:
access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name# [09/Sep/2013:12:58:30 +0200] "CLOSE kJ8fZO" 0 -
access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name# [09/Sep/2013:12:58:30 +0200] "STAT /filename.csv" - -
access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name# [09/Sep/2013:12:59:52 +0200] "CLOSE dLYy6P" 0 -
access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name# [09/Sep/2013:12:59:52 +0200] "CLOSE U9QK7V" 0 -
access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name# [09/Sep/2013:12:59:52 +0200] "OPEN /filename.csv" - 0
access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name# [09/Sep/2013:12:59:52 +0200] "OPEN /filename.csv" - 0
access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name# [09/Sep/2013:12:59:52 +0200] "READ RKnXZU" 1 0
access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name# [09/Sep/2013:12:59:52 +0200] "READ RKnXZU" 1 0
access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name# [09/Sep/2013:12:59:52 +0200] "READ RKnXZU" 1 0
    ...

I have also tried to download files from a FTP (same properties...) and had no problems.

Can someone give me some pointers?
Thanks




Reply | Threaded
Open this post in threaded view
|

Re: SFTP file retrieval does not work

Bengt Rodehav
It looks like the username hasn't been propagated to the server. I normally
specify the user as follows:

sftp://user@host?password=password

According to the documentation your way should work too but perhaps there
is a bug in the sftp component that prevents it from checking the
"username" parameter?

/Bengt


2013/9/12 viktoria <[hidden email]>

> Hi -
> I am trying to get some files from a remote sftp server. It does not give
> me
> any exception but does not work either.
> I am using Camel version 2.12.0, with Spring version 3.0.5.
> Using an ordinary sftp client (FileZilla) i am able to download the files.
>
> Here is my route (Spring-DSL):
>
> <route id="sftpToJMSRoute">
>     <from
>
> uri="sftp://host?password=password&amp;username=user&amp;noop=true&amp;recursive=true&amp;idempotent=true&amp;idempotentKey=${file:name}-${file:size}-${file:modified}&amp;idempotentRepository=#fileStore"/>
>     <process ref="downloadLogger" />
>     <to uri="file://c:/.../?recursive=true" />
> </route>
>
> I have tried many combination.  I gave a filename ... nothing worked.  Here
> is the logfile:
>     ...
> 2013-09-12 10:02:26,890 DEBUG SftpEndpoint:270 - Parameters for Generic
> file
> process strategy {readLock=none, fastExistsCheck=false, noop=true,
> readLockTimeout=20000, readLockLoggingLevel=WARN, readLockMinLength=1,
> readLockCheckInterval=5000}
> 2013-09-12 10:02:26,890 DEBUG SftpEndpoint:183 - Using Generic file process
> strategy:
>
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@663e480f
> 2013-09-12 10:02:26,890 TRACE SftpConsumer:50 - prePollCheck on
> sftp://######@#########:22
> 2013-09-12 10:02:26,921 TRACE TimerListenerManager:86 - Running scheduled
> TimerListener task
> 2013-09-12 10:02:26,921 DEBUG SftpConsumer:152 - Not connected/logged in,
> connecting to: sftp://######@##########:22
> 2013-09-12 10:02:26,921 TRACE TimerListenerManager:95 - Invoking onTimer on
> org.apache.camel.management.mbean.ManagedCamelContext@742ab836
> 2013-09-12 10:02:26,921 TRACE SftpOperations:111 - Session isn't connected,
> trying to recreate and connect.
> 2013-09-12 10:02:26,921 TRACE TimerListenerManager:95 - Invoking onTimer on
> org.apache.camel.management.mbean.ManagedSuspendableRoute@5e411af2
> 2013-09-12 10:02:26,953 DEBUG SftpOperations:259 - Using
> StrickHostKeyChecking: no
> 2013-09-12 10:02:26,953 TRACE SftpOperations:114 - Connecting use
> connectTimeout: 10000 ...
> 2013-09-12 10:02:26,953  INFO SftpOperations:359 - JSCH -> Connecting to
> #host# port 22
> 2013-09-12 10:02:26,999  INFO SftpOperations:359 - JSCH -> Connection
> established
> 2013-09-12 10:02:27,093  INFO SftpOperations:359 - JSCH -> Remote version
> string: SSH-2.0-mod_sftp/0.9.7
> 2013-09-12 10:02:27,093  INFO SftpOperations:359 - JSCH -> Local version
> string: SSH-2.0-JSCH-0.1.39
> 2013-09-12 10:02:27,093  INFO SftpOperations:359 - JSCH -> CheckCiphers:
> aes256-cbc,aes192-cbc,aes128-cbc
> 2013-09-12 10:02:27,140  INFO SftpOperations:359 - JSCH -> aes256-cbc is
> not
> available.
> 2013-09-12 10:02:27,140  INFO SftpOperations:359 - JSCH -> aes192-cbc is
> not
> available.
> 2013-09-12 10:02:27,140  INFO SftpOperations:359 - JSCH -> SSH_MSG_KEXINIT
> sent
> 2013-09-12 10:02:27,140  INFO SftpOperations:359 - JSCH -> SSH_MSG_KEXINIT
> received
> 2013-09-12 10:02:27,140  INFO SftpOperations:359 - JSCH -> kex:
> server->client aes128-cbc hmac-md5 none
> 2013-09-12 10:02:27,140  INFO SftpOperations:359 - JSCH -> kex:
> client->server aes128-cbc hmac-md5 none
> 2013-09-12 10:02:27,155  INFO SftpOperations:359 - JSCH ->
> SSH_MSG_KEXDH_INIT sent
> 2013-09-12 10:02:27,155  INFO SftpOperations:359 - JSCH -> expecting
> SSH_MSG_KEXDH_REPLY
> 2013-09-12 10:02:27,202  INFO SftpOperations:359 - JSCH -> ssh_rsa_verify:
> signature true
> 2013-09-12 10:02:27,218  WARN SftpOperations:356 - JSCH -> Permanently
> added
> '#host#' (RSA) to the list of known hosts.
> 2013-09-12 10:02:27,218  INFO SftpOperations:359 - JSCH -> SSH_MSG_NEWKEYS
> sent
> 2013-09-12 10:02:27,249  INFO SftpOperations:359 - JSCH -> SSH_MSG_NEWKEYS
> received
> 2013-09-12 10:02:27,249  INFO SftpOperations:359 - JSCH ->
> SSH_MSG_SERVICE_REQUEST sent
> 2013-09-12 10:02:27,280  INFO SftpOperations:359 - JSCH ->
> SSH_MSG_SERVICE_ACCEPT received
> 2013-09-12 10:02:27,311  INFO SftpOperations:359 - JSCH -> Authentications
> that can continue: publickey,keyboard-interactive,password
> 2013-09-12 10:02:27,311  INFO SftpOperations:359 - JSCH -> Next
> authentication method: publickey
> 2013-09-12 10:02:27,311  INFO SftpOperations:359 - JSCH -> Authentications
> that can continue: password
> 2013-09-12 10:02:27,311  INFO SftpOperations:359 - JSCH -> Next
> authentication method: password
> 2013-09-12 10:02:27,374  INFO SftpOperations:359 - JSCH -> Authentication
> succeeded (password).
> 2013-09-12 10:02:27,374 TRACE SftpOperations:122 - Channel isn't connected,
> trying to recreate and connect.
> 2013-09-12 10:02:27,421 TRACE SftpOperations:126 - Connecting use
> connectTimeout: 10000 ...
> 12.09.2013 10:02:27 com.sun.xml.ws.transport.http.servlet.WSServletDelegate
> <init>
> INFO: WSSERVLET14: JAX-WS servlet initializing
> 2013-09-12 10:02:27,920 TRACE TimerListenerManager:86 - Running scheduled
> TimerListener task
> 2013-09-12 10:02:27,920 TRACE TimerListenerManager:95 - Invoking onTimer on
> org.apache.camel.management.mbean.ManagedCamelContext@742ab836
> 2013-09-12 10:02:27,920 TRACE TimerListenerManager:95 - Invoking onTimer on
> org.apache.camel.management.mbean.ManagedSuspendableRoute@5e411af2
> 2013-09-12 10:02:28,919 TRACE TimerListenerManager:86 - Running scheduled
> TimerListener task
> 2013-09-12 10:02:28,919 TRACE TimerListenerManager:95 - Invoking onTimer on
> org.apache.camel.management.mbean.ManagedCamelContext@742ab836
> 2013-09-12 10:02:28,919 TRACE TimerListenerManager:95 - Invoking onTimer on
> org.apache.camel.management.mbean.ManagedSuspendableRoute@5e411af2
> 2013-09-12 10:02:29,918 TRACE TimerListenerManager:86 - Running scheduled
> TimerListener task
> 2013-09-12 10:02:29,918 TRACE TimerListenerManager:95 - Invoking onTimer on
> org.apache.camel.management.mbean.ManagedCamelContext@742ab836
> 2013-09-12 10:02:29,918 TRACE TimerListenerManager:95 - Invoking onTimer on
> org.apache.camel.management.mbean.ManagedSuspendableRoute@5e411af2
> 2013-09-12 10:02:30,917 TRACE TimerListenerManager:86 - Running scheduled
> TimerListener task
> 2013-09-12 10:02:30,917 TRACE TimerListenerManager:95 - Invoking onTimer on
> org.apache.camel.management.mbean.ManagedCamelContext@742ab836
> 2013-09-12 10:02:30,917 TRACE TimerListenerManager:95 - Invoking onTimer on
> org.apache.camel.management.mbean.ManagedSuspendableRoute@5e411af2
>     ...
>
> I have tried to route against an other sftp server: Same problem.
> The log from the sftp looks like this:
> access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name#
> [09/Sep/2013:12:58:30 +0200] "CLOSE kJ8fZO" 0 -
> access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name#
> [09/Sep/2013:12:58:30 +0200] "STAT /filename.csv" - -
> access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name#
> [09/Sep/2013:12:59:52 +0200] "CLOSE dLYy6P" 0 -
> access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name#
> [09/Sep/2013:12:59:52 +0200] "CLOSE U9QK7V" 0 -
> access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name#
> [09/Sep/2013:12:59:52 +0200] "OPEN /filename.csv" - 0
> access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name#
> [09/Sep/2013:12:59:52 +0200] "OPEN /filename.csv" - 0
> access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name#
> [09/Sep/2013:12:59:52 +0200] "READ RKnXZU" 1 0
> access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name#
> [09/Sep/2013:12:59:52 +0200] "READ RKnXZU" 1 0
> access_log-20130910.gz:80.148.10.86 UNKNOWN #user_name#
> [09/Sep/2013:12:59:52 +0200] "READ RKnXZU" 1 0
>     ...
>
> I have also tried to download files from a FTP (same properties...) and had
> no problems.
>
> Can someone give me some pointers?
> Thanks
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/SFTP-file-retrieval-does-not-work-tp5739246.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>