java jsch SSH_MSG_DISCONNECT Failed to read binary packet data

 ̄綄美尐妖づ 提交于 2019-12-24 11:35:36

问题


So I use a private key to connect to the sftp server ,so it came back error:

 com.jcraft.jsch.JSchException: SSH_MSG_DISCONNECT: 2 Failed to read binary packet data!

Here is the code:

    JSch jsch = new JSch();
    jsch.addIdentity(new File(privateKey).getAbsolutePath());
    session = jsch.getSession(ftpUserName, ftpHost, ftpPort);
    LOGGER.debug("Session created.");
    if (ftpPassword != null) {
        session.setPassword(ftpPassword);
    }
    Properties config = new Properties();
    config.put("StrictHostKeyChecking", "no");
    session.setConfig(config);
    session.setTimeout(timeout);
    session.connect();

is there anything in my code or i missed something?thank you.

来源:https://stackoverflow.com/questions/32307009/java-jsch-ssh-msg-disconnect-failed-to-read-binary-packet-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!