Connection error using jsch

Asked

Viewed 7 times

0

I am trying to connect to the FTP server via sftp (JSCH) version 0.1.53 with JDK 1.5.0.22 and I have an error in connection when I try to do via SSH key authentication, but when I do user authentication and password works.

public String connectionSFTP() throws FileNotFoundException {
    try {
        jsch.addIdentity(privateKey);       
        session = jsch.getSession(getUsername(), getHost(), getPort());
        session.setConfig("PreferredAuthentications", "publickey,keyboard-interactive,password");
        Properties config = new Properties(); 
        config.put("StrictHostKeyChecking", "no"); 
        session.setConfig(config);
        session.connect();          
    } catch (JSchException e) {
        LOGGER.warn(String.format("Erro JSchException '%s' ", e.toString()));
        return e.toString();
    }
    return "";

I am receiving the following exception: com.jcraft.jsch.Jschexception: Session.connect: java.io.Ioexception: End of IO Stream Read

Someone can help me! Only to complete when configuring for java 7 the application works, but I need it to run in version 5.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.