Ftpsclient上传文件到ftp时storeFile总是返回false(522 data connections must be encrypted)

使用java中org.apache.commons.net.ftp的FTPSClient将文件上传服务器时,调用storeFile总是返回false。

及时打印fClient.getReplyCode()和fClient.getReplyString(),返回522 data connections must be encrypted。

后来增加如下代码,解决问题

this.fClient.enterLocalPassiveMode();
this.fClient.setFileTransferMode(FTP.STREAM_TRANSFER_MODE);
this.fClient.execPROT("P");

猜你喜欢

转载自shukuiyan.iteye.com/blog/2312901