title: com.jcraft.jsch.JSchException: SSH_MSG_DISCONNECT: 2 Too many authentication failures
body: <p>I am trying to do <code>SFTP from Apache Camel + JSch + SpringBoot</code>.To connect to Linux SFTP which is working but for Windows SFTP failing. In <code>WinSCP Both Linux and Windows SFTPs are working</code>.</p>
  
  <p><strong>Route:</strong></p>
  
  <pre><code>@Component
  public class ReadSFTPFileRoute extends RouteBuilder {
  
      // Scenario 1 Read file from Windows using below details not working
      //default home directory /home/FTPAPPUI
      //path to be used to access files /home/FTPAPPUI/share/APP_Migration
      public static String user = "ABC+FTPAPPUI";
      public static String pass = "A=BC#d+dEfg-2HI";
      public static String host = "sftp.host.com";
      public static String path = "/share/APP_Migration";
  
  
      // Scenario 2 Read file from Linux using below details  working
      //default home directory /home/ftpappti
      //path to be used to access files /home/ftpappti/tmp/app/test1 
      public static String user = "ftpappti";
      public static String pass = "AB7cDE@F2#9Ghij";
      public static String host = "1.0.0.1";
      public static String path = "/tmp/app/test1";         
  
      @Override
      public void configure() throws Exception {
  
          from("sftp://"+user+"@"+host+path
                  + "?strictHostKeyChecking=no"
                  + "&amp;useUserKnownHostsFile=false"
                  + "&amp;delete=true&amp;moveFailed=.error"
                  + "&amp;password="+pass
                  + "&amp;preferredAuthentications=publickey,keyboard-interactive,password")
          .process(exchange -&gt; {
              System.out.println("Processing File");
          }).to("file://src/main/resources/out/"
                  + "?fileName=outfile-name.txt"
                  + "&amp;fileExist=Append");
      }
  }
  </code></pre>
  
  <p><strong>Output of Scenario 1:(Windows) Exception</strong></p>
  
  <pre><code>main][0;39m [36mo.a.c.c.file.remote.SftpOperations      [0;39m [2m:[0;39m JSCH -&gt; Permanently added 'sftp.host.com' (RSA) to the list of known hosts.
  main][0;39m [36mo.a.c.c.file.remote.SftpOperations      [0;39m [2m:[0;39m JSCH -&gt; Permanently added 'sftp.host.com' (RSA) to the list of known hosts.
  main][0;39m [36mo.a.c.c.file.remote.SftpOperations      [0;39m [2m:[0;39m JSCH -&gt; Permanently added 'sftp.host.com' (RSA) to the list of known hosts.
  main][0;39m [36mo.a.c.c.file.remote.SftpOperations      [0;39m [2m:[0;39m JSCH -&gt; Permanently added 'sftp.host.com' (RSA) to the list of known hosts.
  main][0;39m [36mo.a.c.c.file.remote.SftpConsumer        [0;39m [2m:[0;39m Error auto creating directory: share/APP_Migration due Cannot connect to sftp://ABC+FTPAPPUI@sftp.host.com:22. This exception is ignored.
  
  org.apache.camel.component.file.GenericFileOperationFailedException: Cannot connect to sftp://ABC+FTPAPPUI@sftp.host.com:22
      at org.apache.camel.component.file.remote.SftpOperations.connect(SftpOperations.java:146) ~[camel-ftp-2.19.1.jar:2.19.1]
      at org.apache.camel.component.file.remote.RemoteFileConsumer.connectIfNecessary(RemoteFileConsumer.java:203) ~[camel-ftp-2.19.1.jar:2.19.1]
      at org.apache.camel.component.file.remote.SftpConsumer.doStart(SftpConsumer.java:53) ~[camel-ftp-2.19.1.jar:2.19.1]
      at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3518) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:3835) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3771) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3691) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3455) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3309) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:202) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3093) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3089) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3112) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3089) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3026) [camel-core-2.19.1.jar:2.19.1]
      at org.apache.camel.spring.boot.RoutesCollector.maybeStart(RoutesCollector.java:203) [camel-spring-boot-2.19.1.jar:2.19.1]
      at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:178) [camel-spring-boot-2.19.1.jar:2.19.1]
      at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:50) [camel-spring-boot-2.19.1.jar:2.19.1]
      at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393) [spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347) [spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883) [spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) [spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at com.learnjovi.route.Application.main(Application.java:10) [classes/:na]
  Caused by: com.jcraft.jsch.JSchException: SSH_MSG_DISCONNECT: 2 Too many authentication failures 
      at com.jcraft.jsch.Session.read(Session.java:1004) ~[jsch-0.1.54.jar:na]
      at com.jcraft.jsch.UserAuthPassword.start(UserAuthPassword.java:91) ~[jsch-0.1.54.jar:na]
      at com.jcraft.jsch.Session.connect(Session.java:470) ~[jsch-0.1.54.jar:na]
      at org.apache.camel.component.file.remote.SftpOperations.connect(SftpOperations.java:118) ~[camel-ftp-2.19.1.jar:2.19.1]
      ... 34 common frames omitted
  
  main][0;39m [36mo.a.camel.spring.SpringCamelContext     [0;39m [2m:[0;39m Route: route4 started and consuming from: sftp://ABC+FTPAPPUI@sftp.host.com/share/APP_Migration?delete=true&amp;moveFailed=.error&amp;password=xxxxxx&amp;preferredAuthentications=publickey%2Ckeyboard-interactive%2Cpassword&amp;strictHostKeyChecking=no&amp;useUserKnownHostsFile=false
  main][0;39m [36mo.a.camel.spring.SpringCamelContext     [0;39m [2m:[0;39m Total 1 routes, of which 1 are started.
  </code></pre>
  
  <p><strong>Output of Scenario 2:(Linux)</strong></p>
  
  <pre><code>main] o.a.c.c.file.remote.SftpOperations       : JSCH -&gt; Permanently added '1.0.0.1' (RSA) to the list of known hosts.
  main] o.a.camel.spring.SpringCamelContext      : Route: route4 started and consuming from: sftp://ftpappti@1.0.0.1/tmp/app/test1?delete=true&amp;moveFailed=.error&amp;password=xxxxxx&amp;preferredAuthentications=publickey%2Ckeyboard-interactive%2Cpassword&amp;strictHostKeyChecking=no&amp;useUserKnownHostsFile=false
  main] o.a.camel.spring.SpringCamelContext      : Total 1 routes, of which 1 are started.
  main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.19.1 (CamelContext: camel-1) started in 6.805 seconds
  main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
  main] com.learnjovi.route.Application          : Started Application in 13.878 seconds (JVM running for 16.309)
  Processing File
  </code></pre>
  
  <p><strong>pom.xml:</strong></p>
  
  <pre><code>  &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.5.9.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-spring-boot-starter&lt;/artifactId&gt;
              &lt;version&gt;2.21.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-stream&lt;/artifactId&gt;
              &lt;version&gt;2.21.0&lt;/version&gt;
          &lt;/dependency&gt;
                  &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-ftp&lt;/artifactId&gt;
              &lt;version&gt;2.21.0&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  </code></pre>