有没有大佬能解决下
public static boolean initChannel(String host,Integer port,String userName,String password){
try {
JSch jSch = new JSch();
sshSession = jSch.getSession(userName,host,port);
sshSession.setPassword(password);
Properties sshConfig = new Properties();
sshConfig.put("StrictHostKeyChecking", "no");
sshSession.setConfig(sshConfig );
//sshSession.setTimeout(60);
sshSession.connect();
Channel channel = sshSession.openChannel("sftp");
channel.connect();
sftp = (ChannelSftp) channel;
return true;
} catch (JSchException e) {
e.printStackTrace();
logger.error("sftp连接失败,host:{},port:{}",host,port,e);
return false;
}
}
打断点发现是卡在sshSession.connect()方法一直过不去,在这段
而且设置了timeout时间也不会报超时错误,就一直卡在这里