camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aida <>
Subject [FTP2] Problems transversing directories when uploading files with SFTP (Camel 2.9.4)
Date Fri, 30 Nov 2012 13:50:14 GMT

I have been having trouble trying to upload files using a sftp endpoint.

The way I'm working to upload a file is using a ProducerTemplate ( 
ProducerTemplate.send(endPointDefinition, data2write) where data2write is
the Exchange with the data I want to upload ). This way works for me working
with FTP servers and "ftp://***" endpoints, but when trying to use a server
that needs SFTP, the connection is made successfully, but there is a
failure/exception when tries to access to the directory where the file
should be uploaded.

I have seen that the reason of this behaviour is that the name of the folder
I want to use haven´t got the first character, so if the folder was
"myFolder", it tries to  change the directory to "yFolder". The message I
can retrieve from the received Exchange is "Cannot change directory to:
yFolder". However, the endpoint is wellformed. I'm sure of this because I
see it in the log trace (set at INFO level), example:

2012-11-30 12:33:35,414 INFO 
[org.apache.camel.component.file.remote.RemoteFileProducer] (Camel
(processesCamelContext) thread #12 - JmsConsumer[App_JOBS_QUEUE_IN])
Connected and logged in to:
2012-11-30 12:33:35,537 WARNING
[org.apache.camel.component.file.remote.RemoteFileProducer] (Camel
(processesCamelContext) thread #12 - JmsConsumer[App_JOBS_QUEUE_IN]) Writing
file failed with: Cannot change directory to: yFolder

I don´t know if it could be a kind of "escape characters issue", but I put
here the results of some tests:

1. Endpoint: sftp://myFtpHost@XXX.XX.XXX.XX:22/myFolder?charset= ...
   Result message: Cannot change directory to: yFolder
2. Endpoint:  sftp://myFtpHost@XXX.XX.XXX.XX:22/mmyFolder?charset= ...
   Result message: Cannot change directory to: myFolder   -> here the dir
name is OK but it still fails (and strictly the endpoint it´s not correct)
3. Endpoint:  sftp://myFtpHost@XXX.XX.XXX.XX:22//myFolder?charset= ...
	Result message: Cannot change directory to: yFolder

I have tried with two different separators (Auto and UNIX) when building the
endpoint, but the result is the same.	

Looking into the FTP2 component documentation, I have found a way to make it
work. This is using the stepwise option set to false. This way works, but
what worries me is that (for security issues) not all the FTP servers allow
this option.	

Additional Info:
	Apache Camel version: 2.9.4
	Camel processes running on Windows machine
	FTP where files are uploaded running on Linux machine, using SFTP

Maybe I'm missing something. Any help would be appreciated.

Thanks in advance.


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message