FTPSClient from Apache Commons Net 3.9.0 not working

119 views Asked by At

I am trying to use the FTPSClient class from Apache Commons Net 3.9.0 just to list files on the server. Here is my code:

    public static void main(String[] args) throws IOException {
        FTPSClient ftpClient = new FTPSClient();
        ftpClient.connect("127.0.0.1");
        ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
        ftpClient.enterLocalPassiveMode();
        ftpClient.login("user", "");
        ftpClient.execPBSZ(0L);
        ftpClient.execPROT("P");
        for (FTPFile ftpFile : ftpClient.listFiles()) {
            System.out.println(ftpFile.getName());
        }
        ftpClient.disconnect();
    }

The significant logs from the server are:

FTP Session 18 127.0.0.1 user [Command] LIST
FTP Session 18 127.0.0.1 user [Response] 150 Starting data transfer.
FTP Session 18 127.0.0.1 user [Error] TLS session of data connection not resumed.
FTP Session 18 127.0.0.1 user [Response] 425 Unable to build data connection: TLS session of data connection not resumed.
FTP Session 18 127.0.0.1 user [Error] Received TLS alert from the client: User canceled (90)

What is the problem here? In addition, the server works using explicit FTPS.

0

There are 0 answers