debug每次运行到Connection .connect()方法时就会抛出连接过早关闭异常

debug每次运行到conn.connect()方法时就会抛出连接过早关闭异常

import ch.ethz.ssh2.Connection;
import ch.ethz.ssh2.Session;
import ch.ethz.ssh2.StreamGobbler;

public class   manager{

    String  chineseToFirstLetter = xxx;
    private final String hostName = "xx.xx.xx.xx";
    private final int port = xxxx;
    private final String userName = "xxxx";
    private final String password = "xxxx";

    scriptSql.getConn(chineseToFirstLetter);
        Connection conn = new Connection(hostName,port);
        Session sess = null;
        try {
            conn.connect();
            boolean isAuthenticated = conn.authenticateWithPassword(userName,
                    password);
            if (isAuthenticated == false) {
                return BaseDtoHttp.ofError(530,"连接不上服务器!");
            }
            sess = conn.openSession();
            sess.execCommand("sh D:/test/sql.sh"+ chineseToFirstLetter);
            InputStream stdout = new StreamGobbler(sess.getStdout());
            BufferedReader br = new BufferedReader(
                    new InputStreamReader(stdout));
            while (true) {
                String line = br.readLine();
                if (line == null) {
                    break;
                }
                System.out.println(line);
            }
        } catch (IOException e) {
            return BaseDtoHttp.ofError(530,"创建失败!");
        } finally {
            sess.close();
            conn.close();
        }
}

img

求帮忙看看这个情况该怎么解决呢,谢谢

这句是干啥的?


    scriptSql.getConn(chineseToFirstLetter);