首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 服务器 > Apache >

apache FTP server 没法登陆

2012-09-19 
apache FTP server无法登陆从http://mina.apache.org/ftpserver/downloads.html下载的Apache FtpServer 1.

apache FTP server 无法登陆
从http://mina.apache.org/ftpserver/downloads.html下载的Apache FtpServer 1.0.5 Release 解压后,运行。网页中输入ftp://localhost  提示输入账号密码,怎么也登陆不上!

因为默认的ftpd.bat 并未读取配置文件。
将ftpd.bat res/conf/ftpd-typical.xml保存为myftpd.bat,来将配置文件参数传入,执行该文件后就可以了。

在java程序中嵌入该服务器,新建java工程,并将apache-ftpserver-1.0.5\common\lib 下的包加载进来,common\classes下的log4j.properties加到src目录下,apache-ftpserver-1.0.5\res放到工程目录下;

FtpServerFactory serverFactory = new FtpServerFactory();
FtpServer server = serverFactory.createServer();

// start the server
server.start();

此时也还不可以,因为也没读配置文件,加入下面代码:

PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
userManagerFactory.setFile(new File("此处是users.properties的路径"));

运行后服务就开启了!

热点排行