java jsch SSH_MSG_DISCONNECT Failed to read binary packet data

匿名 (未验证) 提交于 2019-12-03 01:06:02

问题:

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.

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