title: Camel sftp Writing file failed with: Cannot store file
body: <p>I have couple days, look around apache Camel and transfer files over sftp server to jms queue or topic. </p>
  
  <p>I faced a problems at a level of configuring an endpoints (consumer) , also routes (from file to sftp, from sftp to jms.....). Nothing works to me. 
  I work on sftp server (linux), java version "1.7.0_45"
  I use apache camel 2.5, activemq 5.3.2, 
  I uploaded Jsch jar, </p>
  
  <p>this is my simple code </p>
  
  <pre><code>public class FtpJms {
  
      public static void main(String args[]) throws Exception {
          CamelContext context = new DefaultCamelContext();
          context.addRoutes(new RouteBuilder() {
               @Override
              public void configure() {
  
              from("file://usr/dir1/dir2?noop=true").
              to("sftp://root@hostname/inbox?username=root&amp;password=xxx");
          }});
  </code></pre>
  
  <p>I package my program into a jar file, then, I run it on server. 
  However, it returns :</p>
  
  <pre><code>[ - file://usr/dir1/dir2] SftpOperations                 INFO  JSCH -&gt; Authentications that can continue: password
  [ - file://usr/dir1/dir2] SftpOperations                 INFO  JSCH -&gt; Next authentication method: password
  [ - file://usr/dir1/dir2] SftpOperations                 INFO  JSCH -&gt; Authentication succeeded (password).
  [ - file://usr/dir1/dir2] SftpOperations                 INFO  Connected to sftp://root@hostname:22
  [ - file://usr/dir1/dir2] RemoteFileProducer             INFO  Connected and logged in to: Endpoint[sftp://root@hostname/inbox?password=******&amp;username=root]
  [ - file://usr/dir1/dir2] RemoteFileProducer             WARN  Writing file failed with: Cannot store file: inbox/test10.txt
  [ - file://usr/dir1/dir2] SftpOperations                 INFO  JSCH -&gt; Disconnecting from hostname port 22
  [ - file://usr/dir1/dir2] GenericFileOnCompletion        ERROR Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot store file: inbox/test10.txt]
  org.apache.camel.component.file.GenericFileOperationFailedException: Cannot store file: inbox/test10.txt
          at org.apache.camel.component.file.remote.SftpOperations.storeFile(SftpOperations.java:617)[jar:rsrc:camel-ftp-2.5.0.jar!/:]
          at org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:220)[jar:rsrc:camel-core-2.5.0.jar!/:]
          at org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:138)[jar:rsrc:camel-core-2.5.0.jar!/:]
          at org.apache.camel.component.file.remote.RemoteFileProducer.process(RemoteFileProducer.java:49)[jar:rsrc:camel-ftp-2.5.0.jar!/:]
          at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)[jar:rsrc:camel-core-2.5.0.jar!/:]
  </code></pre>