首页

报FTPException:"code=421, message= Maximum login limit has been reached"错误

标签:ftp错误,FTPException,异常,java,FTP,发布异常,ftp4j,sauronsoftware,apache-ftpserver,配置连接数,性能优化     发布时间:2015-12-20   

一、现象描述

通过ftp客户端代码登录ftp服务器向指定目录发布文件,发生FTPException异常,消息提示“Maximum login limit has been reached”,详情如下:

_, ftpserver0_.CREATE_TIME as CREATE8_12_0_, ftpserver0_.UPDATE_TIME as UPDATE9_@b@12_0_, ftpserver0_.STATUS as STATUS12_0_, ftpserver0_.VIRTUAL_DIR as VIRTUAL11_1@b@2_0_ from FTPSERVER ftpserver0_ where ftpserver0_.ID=?@b@[INFO ][2015-12-20 21:56:26][com.xwood.pms.core.ftp.IssFTPClient.login(IssFTPClien@b@t.java:74)]:建立连接@b@it.sauronsoftware.ftp4j.FTPException [code=421, message= Maximum login limit has@b@ been reached.]@b@        at it.sauronsoftware.ftp4j.FTPClient.login(FTPClient.java:1242)@b@        at it.sauronsoftware.ftp4j.FTPClient.login(FTPClient.java:1168)@b@        at com.xwood.pms.core.ftp.IssFTPClient.login(IssFTPClient.java:82)@b@        at com.xwood.pms.util.publisher.FtpOms.upload(FtpOms.java:171)@b@        at com.xwood.pms.util.publisher.FtpOms.upload(FtpOms.java:144)@b@        at com.xwood.pms.service.impl.FilePublisher.createAndPublishWithMultiPorta@b@ls(FilePublisher.java:306)@b@        at com.xwood.pms.util.publisher.PublishRunnable.call(PublishRunnable.java:@b@59)@b@        at com.xwood.pms.util.publisher.PublishRunnable.call(PublishRunnable.java:@b@1)@b@        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)@b@        at java.util.concurrent.FutureTask.run(Unknown Source)@b@        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source@b@)@b@        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)@b@        at java.lang.Thread.run(Unknown Source)@b@[INFO ][2015-12-20 21:56:26][com.xwood.pms.core.ftp.IssFTPClient.login(IssFTPClien@b@t.java:87)]:登录FTP服务器失败!Maximum login limit has been reached.@b@java.lang.IllegalStateException: Client not authenticated@b@        at it.sauronsoftware.ftp4j.FTPClient.changeDirectory(FTPClient.java:1610@b@)@b@        at com.xwood.pms.core.ftp.IssFTPClient.changeDirectory(IssFTPClient.java:2@b@04)@b@        at com.xwood.pms.util.publisher.FtpOms.upload(FtpOms.java:172)@b@        at com.xwood.pms.util.publisher.FtpOms.upload(FtpOms.java:144)@b@        at com.xwood.pms.service.impl.FilePublisher.createAndPublishWithMultiPorta@b@ls(FilePublisher.java:306)@b@        at com.xwood.pms.util.publisher.PublishRunnable.call(PublishRunnable.java:@b@59)@b@        at com.xwood.pms.util.publisher.PublishRunnable.call(PublishRunnable.java:@b@1)@b@        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)@b@        at java.util.concurrent.FutureTask.run(Unknown Source)@b@        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source@b@)@b@        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)@b@        at java.lang.Thread.run(Unknown Source)@b@com.xwood.pms.core.freemarker.exception.FtpException: ftp异常!file:/_site_domain_@b@/_root/5870/5930/5931/6189/6515//E:/SaaServices/tomcat6-exe/webapps/ROOT/_root/5@b@870/5930/5931/6189/6515/index.htmlClient not authenticated@b@        at com.xwood.pms.util.publisher.FtpOms.upload(FtpOms.java:188)@b@        at com.xwood.pms.util.publisher.FtpOms.upload(FtpOms.java:144)@b@        at com.xwood.pms.service.impl.FilePublisher.createAndPublishWithMultiPorta@b@ls(FilePublisher.java:306)

二、解决步骤

1.  从FTPException异常消息很明显,是因ftp客户端登陆数超上限造成的,所以需将ftp服务器的登录数限制配置参数调大

2.  这边是用的 apache-ftpserver-1.0.6 (如是其他服务器如vsftpd、ServU请修改其配置),启动命令是通过ftpd-typical.xml的xml配置参数进行初始化ftpserver对象

报FTPException:"code=421, message= Maximum login limit has  been reached"错误

3. 通过ftp默认启动,定位根目录common -> lib -> f tpserver-core-1.0.6.jar包文件

报FTPException:"code=421, message= Maximum login limit has  been reached"错误

4. 通过源码查找最大登录数相关配置文件及属性(max-logins最大登录数),找到如下图所示

报FTPException:"code=421, message= Maximum login limit has  been reached"错误

5.  找到ftpd-typical.xml初始化配置文件,配置了如下箭头所示属性(max-logins="999999")

报FTPException:"code=421, message= Maximum login limit has  been reached"错误

<server xmlns="http://mina.apache.org/ftpserver/spring/v1"@b@    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"@b@    xsi:schemaLocation="@b@       http://mina.apache.org/ftpserver/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd    @b@       "@b@    id="myServer" max-logins="999999"  max-threads="9999">@b@    <listeners>@b@        <nio-listener name="default" port="21">@b@            <ssl>@b@                <keystore file="./res/ftpserver.jks" password="password" />@b@            </ssl>@b@        </nio-listener>@b@    </listeners>@b@    <file-user-manager file="./res/conf/users.properties" encrypt-passwords = "clear" />@b@</server>

6. 重启服务,一切正常

<<热门下载>>