Problems with connecting with it.sauronsoftware.ftp4j.FTPClient to SFTP

145 Views Asked by At

I am having problems connecting with it.sauronsoftware.ftp4j.FTPClient.

I want to use SFTP but always get errors.

  • If I use:

    sftpClient.setSecurity(FTPClient.SECURITY_FTPES)
    

    I get: ERROR c.l.datamanager.Ftp4jFTPTask - it.sauronsoftware.ftp4j.FTPIllegalReplyException ERROR c.l.datamanager.Ftp4jFTPTask - java.lang.IllegalStateException: Client not connected

  • If I use

    sftpClient.setSecurity(FTPClient.SECURITY_FTPS);
    

    I get: ERROR c.l.datamanager.Ftp4jFTPTask - javax.net.ssl.SSLException: Unsupported or unrecognized SSL message c.l.datamanager.Ftp4jFTPTask - java.lang.IllegalStateException: Client not connected

Please let me know how I can use SFTP in it.sauronsoftware.ftp4j.FTPClient.

1

There are 1 best solutions below

0
On

FTPES is not SFTP. You cannot use FTP(E(S)) library to connect to an SFTP server. FTP and SFTP are two completely different protocols.

You have to use an SFTP library. See Java SFTP Transfer Library