1
我使用Apache Mina sshd-core-1.0.0啓動SFTP守護進程。該程序在sshd.start()
之後退出。沒有錯誤。但是如果我使用sshd-core-0.0.14,服務器啓動就好了,我可以啓動一個SFTP會話。我錯過了1.0.0的東西嗎?Apache Mina SSHD 1.0服務器立即退出
代碼1.0.0片斷(不工作)
public static void main(String[] args) throws IOException {
SshServer sshd = SshServer.setUpDefaultServer();
sshd.setPort(2222);
sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File ("hostkey.ser")))
sshd.setPasswordAuthenticator(new AuthenticatorImpl());
sshd.start();
}
代碼段與0.0.14(作品)
public static void main(String[] args) throws IOException {
SshServer sshd = SshServer.setUpDefaultServer();
sshd.setPort(2222);
sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey.ser"));
sshd.setPasswordAuthenticator(new AuthenticatorImpl());
sshd.start();
}
以下是輸出1.0.0運行時。代碼開始正常,但在sshd.start()
聲明後終止。
2015-12-16 19:57:38,510 DEBUG SFTPServer.main(SFTPServer.java:26) message
2015-12-16 19:57:38,767 INFO org.apache.sshd.common.util.SecurityUtils$BouncyCastleRegistration.call(SecurityUtils.java:145) Trying to register BouncyCastle as a JCE provider
2015-12-16 19:57:39,076 INFO org.apache.sshd.common.util.SecurityUtils$BouncyCastleRegistration.call(SecurityUtils.java:149) Registration succeeded
2015-12-16 19:57:39,105 DEBUG org.apache.sshd.common.io.nio2.Nio2Acceptor.bind(Nio2Acceptor.java:57) Binding Nio2Acceptor to address 0.0.0.0/0.0.0.0:2222
2015-12-16 19:57:39,114 INFO SFTPServer.main(SFTPServer.java:32) Started
謝謝你的作品。 – Rocky
該解決方案徹底打破了您可能希望在應用程序上運行的任何集成測試。 – christopher