0
(Windows) SFTP 서버에 연결하려고 할 때 문제가 있습니다. SFTP 서버의 이름은 Secure Bridge입니다 (Windows의 경우). 가끔 제대로 작동하지만 언젠가는 작동하지 않기 때문에 이상합니다. 언젠가는 아래와 같은 오류를 보여줍니다. 내 출처가 아래에 있습니다. 당신이 나를 도울 수? 이 오류가 발생하는 이유는 무엇입니까?SFTP 연결 오류 (전송 프로토콜 연결이 끊김)
[Error]
java.io.IOException: The transport protocol disconnected
com.sshtools.j2ssh.transport.TransportProtocolCommon.readMessage(Unknown Source)
com.sshtools.j2ssh.transport.TransportProtocolCommon.sendNewKeys(Unknown Source)
com.sshtools.j2ssh.transport.TransportProtocolCommon.beginKeyExchange(Unknown Source)
com.sshtools.j2ssh.transport.TransportProtocolCommon.onMsgKexInit(Unknown Source)
com.sshtools.j2ssh.transport.TransportProtocolCommon.startBinaryPacketProtocol(Unknown Source)
com.sshtools.j2ssh.transport.TransportProtocolCommon.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
private SshClient client = null;
private PasswordAuthenticationClient auth = null;
private SftpClient sftp = null;
public boolean connect(String server,
int port,
String user,
String pwd) throws Exception {
try {
if (server == null || user == null || pwd == null) {
logger.error("Parameter is null!");
throw new Exception("Parameter is null!");
}
SshConnectionProperties params = new SshConnectionProperties();
params.setHost(server);
params.setPort(port);
HostKeyVerification key = new HostKeyVerification() {
@Override
public boolean verifyHost(String arg0,
SshPublicKey arg1) throws TransportProtocolException {
return true;
}
};
client = new SshClient();
client.setSocketTimeout(10000);
client.connect(params, key);
auth = new PasswordAuthenticationClient();
auth.setUsername(user);
auth.setPassword(pwd);
int result = client.authenticate(auth);
if (result != AuthenticationProtocolState.COMPLETE) {
throw new Exception("Login to " + server + ":" + port + " " + user + "/" + pwd + " failed");
}
sftp = client.openSftpClient();
} catch (Exception e) {
logger.error(e);
logout();
return false;
}
return true;
}
filezilla와 같은 SFTP 클라이언트를 사용하여 동일한 서버에 연결할 수 있습니까? –