got "java.lang.ArrayIndexOutOfBoundsException: null" when making a ssh session.
zhanghp189 opened this issue · 0 comments
zhanghp189 commented
Hi ,
I got "java.lang.ArrayIndexOutOfBoundsException: null" when creating a ssh session:
java.lang.ArrayIndexOutOfBoundsException: null
at com.jcraft.jsch.Buffer.getByte(Buffer.java:148)
at com.jcraft.jsch.Buffer.getString(Buffer.java:188)
at com.jcraft.jsch.Session.read(Session.java:1003)
at com.jcraft.jsch.UserAuthPassword.start(UserAuthPassword.java:91)
at com.jcraft.jsch.Session.connect(Session.java:470)
at com.guangyan.collect.jobhandler.utils.SshMmlClient.doConnect(SshMmlClient.java:207)
the jsch version is 0.1.54, and my code is like:
session = jsch.getSession(host.getSshUsername().trim(), host.getIp().trim(), host.getSshPort());
session.setPassword(host.getSshPassword().trim());
session.setConfig(sshConf);
session.connect(timeout);
session.sendKeepAliveMsg();
session.setServerAliveInterval(1000);
session.setServerAliveCountMax(120);
channel = (ChannelShell)session.openChannel("shell");
((ChannelShell)channel).setPty(true);
channel.connect();