Ainda,

Do you have the correct permissions on the server?


Best Regards
Leandro Franchi


On Fri, Nov 30, 2012 at 11:50 AM, Aida <[email protected]> wrote:

> Hi,
>
> 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:
> Endpoint[sftp://[email protected]
> :22/myFolder?charset=ISO-8859-1&delay=2000&disconnect=true&fileName=myFileName.xml&initialDelay=0&password=******&separator=Auto]
> 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://[email protected]:22/myFolder?charset= ...
>    Result message: Cannot change directory to: yFolder
>
> 2. Endpoint:  sftp://[email protected]: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://[email protected]: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.
>
>   Aida.
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/FTP2-Problems-transversing-directories-when-uploading-files-with-SFTP-Camel-2-9-4-tp5723456.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
*Leandro Franchi*
http://www.frango10.com

Reply via email to