Aci*_*awk 4 java sftp apache-mina
我正在尝试使用Apache Mine SSHD v1.2.0设置一个简单的SFTP服务器.
然而它们都具有共同的同一行,我不能让NetBeans中解决.NetBeans的告诉我,它无法找到Factory在SftpSubsystem.有问题的行看起来如下:
sftpServer.setSubsystemFactories (
Arrays. <NamedFactory <Command >> asList (new SftpSubsystem.Factory ()));
Run Code Online (Sandbox Code Playgroud)
我的main外表如下:
SshServer sftpServer = SshServer.setUpDefaultServer ();
sftpServer.setPort (PORT);
sftpServer.setKeyPairProvider (new SimpleGeneratorHostKeyProvider (new File("hostkey.ser")));
sftpServer.setSubsystemFactories (
Arrays. <NamedFactory <Command >> asList (new SftpSubsystem.Factory ()));
sftpServer.setPasswordAuthenticator (new PasswordAuthenticator () {
@Override
public boolean authenticate (String username, String password, ServerSession session) {
return true;
}
});
sftpServer.start ();
while(true);
Run Code Online (Sandbox Code Playgroud)
我错过了什么?我只想连接到虚拟SFTP服务器并列出一些目录并上传一两个文件.问题是我想从现有的Java应用程序中执行此操作.
提前致谢.
Mar*_*ryl 10
在Apache SSHD的最新版本中,它是SftpSubsystemFactory:
sftpServer.setSubsystemFactories(
Arrays.<NamedFactory<Command>>asList(new SftpSubsystemFactory()));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1312 次 |
| 最近记录: |