I am trying to embed an Apache MINA FTP server in my Scala application and I am having problems resolving it. I am using Apache FtpServer 1.05 and found a couple of examples on my site that don't seem to work when I Scala -ize them.
Here is my code:
package aperture import org.apache.ftpserver.listener.ListenerFactory import org.apache.ftpserver.ftplet._ import org.apache.ftpserver.{FtpServerFactory, FtpServer} import java.io.File import org.apache.ftpserver.usermanager.{UserFactory, SaltedPasswordEncryptor, PropertiesUserManagerFactory} object Main { def main(args: Array[String]) { val serverFactory: FtpServerFactory = new FtpServerFactory() val listenerFactory: ListenerFactory = new ListenerFactory() listenerFactory.setPort(2221); listenerFactory.setServerAddress("localhost") listenerFactory.setImplicitSsl(false); serverFactory.addListener("default", listenerFactory.createListener()) val userManagerFactory: PropertiesUserManagerFactory = new PropertiesUserManagerFactory() userManagerFactory.setFile(new File("myusers.properties")) userManagerFactory.setPasswordEncryptor(new SaltedPasswordEncryptor()) val userManager: UserManager = userManagerFactory.createUserManager() val userFact: UserFactory = new UserFactory() userFact.setName("myNewUser") userFact.setPassword("secret") userFact.setHomeDirectory("ftproot") val user: User = userFact.createUser() userManager.save(user) serverFactory.setUserManager(userManagerFactory.createUserManager())
The code is valid and the server starts working on port 2221, but I canβt connect to it: ftp: localhost:2221: No address associated with hostname and ftp: 127.0.0.1:2221: Name or service not known .
Any thoughts?
source share