title: Jsch error - failed to send channel request
body: <p>I  am trying to connect to a SFTP remote server using JSCH library version 0.1.49. Every time I run the program I receive the following error :</p>
  
  <pre class="lang-java prettyprint-override"><code>Initializing...
  Connection to SFTP server is successfully
  com.jcraft.jsch.JSchException: Unable to connect to SFTP server.com.jcraft.jsch.JSchException: failed to send channel request
  at shell.MainClass.JschConnect(MainClass.java:95)
  at shell.MainClass.main(MainClass.java:30)
  </code></pre>
  
  <p>line 30 is : <code>sftpChannel.connect()</code> from the code below :</p>
  
  <pre class="lang-java prettyprint-override"><code>    System.out.println("Initializing...");
      JSch jsch = new JSch();
  
      Session session = null;
      try {   
          session = jsch.getSession(ProjectConstants.rmUsername,ProjectConstants.rmHost, 22);
          session.setPassword(ProjectConstants.rmPassword);
  
          java.util.Properties config = new java.util.Properties(); 
          config.put("StrictHostKeyChecking", "no");
          session.setConfig(config);
  
          session.connect();
          if (session.isConnected() == true) {
              System.out.println("Connection to SFTP server is successfully");
          }
  
          ChannelSftp sftpChannel = (ChannelSftp) session.openChannel("sftp");
          try {
              sftpChannel.connect();
          } catch (Exception e) {
              throw new JSchException("Unable to connect to SFTP server. "
                      + e.toString());
          }
  </code></pre>
  
  <p>the credentials I am using are correct ( it connects through FileZilla using the same data ), and I also disabled the proxy for that server ( either way I get the same error with or without proxy )</p>
  
  <p>If anyone could help me I would greatly appreciate it as I am stuck with this error for about a week now ...</p>
  
  <p>Thank you.</p>