问题描述
我正在使用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 (将#修改为@)