Java 尽管连接和登录成功,Apache FTPSClient仍无法放置文件
我使用Apache的FTPS客户端通过FTPS连接并将文件放置在服务器上。但它在方法上失败了Java 尽管连接和登录成功,Apache FTPSClient仍无法放置文件,java,ftp,apache-commons,file-transfer,ftps,Java,Ftp,Apache Commons,File Transfer,Ftps,我使用Apache的FTPS客户端通过FTPS连接并将文件放置在服务器上。但它在方法上失败了 String url = "myTestSTore.com"; String user = "fake"; String password = "reallyFake" FTPSClient ftpClient = new FTPSClient(); ftpClient.connect(url); ftpClient.enterLocalPassiveMode() ftpClient.log
String url = "myTestSTore.com";
String user = "fake";
String password = "reallyFake"
FTPSClient ftpClient = new FTPSClient();
ftpClient.connect(url);
ftpClient.enterLocalPassiveMode()
ftpClient.login(user, password);
def reply = ftpClient.getReplyCode();
println "Reply code after logging in is $reply"
FileInputStream fis = new FileInputStream(randomFile)
def reply2 = ftpClient.getReplyCode();
println "Reply Code before attempting file upload is $reply2"
boolean storeFileResult = ftpClient.storeFile(randomFile.getName(), fis)
def reply3 = ftpClient.getReplyCode();
println "Store file $storeFileResult, reply Code after file upload is $reply3"
从这个输出是
06 Aug 2018 11:39:30 - Connecting to ftp server: myTestSTore.com
Reply code after logging in is 234
Reply Code before attempting file upload is 230
Store file result is false ,
and reply Code after file upload is 522
根据回复代码,我们似乎可以连接和登录。但是storeFile方法返回false,之后的回复代码是500
有没有办法说明文件上传失败的原因
简单地返回false并给出500并不能解释上传失败的原因。能否调用ftpClient.getReplyString()获取更多信息?