如何解决SSH2 Ganymade异常ch.ethz.ssh2.channel.ChannelClosedException:SSH通道已关闭
我正在使用juniper-netconf连接到使用juniper netconf-1.0.1的交换机。提取接口时,出现“ ch.ethz.ssh2.channel.ChannelClosedException:SSH通道已关闭”异常。 是什么原因造成的?
class ConnectionWrapper {
Device device=null;
ConnectionWrapper(String hostName,String username,String password) throws Exception{
Device device = Device.builder().hostName(hostName).userName(username).password(password)
.timeout(* 1000).port(22).build();
device.connect();
this.device=device;
}
// getting exception from here
public XML execute(String command) throws Exception {
return device.executeRPC(command);
}
public void close() throws Exception {
device.close();
}
}
//calling from another class
ConnectionWrapper connection = new ConnectionWrapper(host,username,password);
ConnectionWrapper.execute("get-interface-information");
ch.ethz.ssh2.channel.ChannelClosedException:SSH通道已关闭。 (连接正在关闭) 在ch.ethz.ssh2.channel.ChannelManager.sendData(ChannelManager.java:387) 在ch.ethz.ssh2.channel.ChannelOutputStream.write(ChannelOutputStream.java:71) 在ch.ethz.ssh2.channel.ChannelOutputStream.write(ChannelOutputStream.java:77)在net.juniper.netconf.NetconfSession.getRpcReply(NetconfSession.java:82) 在net.juniper.netconf.NetconfSession.executeRPC(NetconfSession.java:219) 在net.juniper.netconf.Device.executeRPC(Device.java:530)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。