Apache Mina SFTP SftpSubsystem.Factory()
apache-mina, java, sftp
Solution
In recent versions of Apache SSHD, it's `SftpSubsystemFactory`:
sftpServer.setSubsystemFactories(
Arrays.<NamedFactory<Command>>asList(new SftpSubsystemFactory()));
Problem
I am trying to setup a simple SFTP server using Apache Mine SSHD v1.2.0. I have looked at several examples on the web E.g. here, here and here. However they all have the same line in common which I cannot get NetBeans to resolve. NetBeans tells me that it cannot find `Factory` in `SftpSubsystem`. The line in question looks as follows: ``` sftpServer.setSubsystemFactories ( Arrays. <NamedFactory <Command >> asList (new SftpSubsystem.Factory ())); ``` My `main` looks something like the following: ``` 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); ``` What am I missing? I simply want to connect to a dummy SFTP server and list some directories and upload a file or two. The thing is that I want to do this from inside an existing java application.