Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9067221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:53:30+00:00 2026-06-16T16:53:30+00:00

I have a remote FileZilla ftp server running on a windows machine. The ftp

  • 0

I have a remote FileZilla ftp server running on a windows machine. The ftp server requires Explicit FTP over TLS. The protocol is FTP and NOT SFTP. I cannot change the settings for this server. I can connect to this server using the filezilla gui client just fine.

Now I need to connect to the FileZilla server through a java application using org.apache.commons.net:

  private void connect(String host, String user, String password) {
    try {
      FTPSClient ftpClient = new FTPSClient(false);
      ftpClient.connect(host);
      int reply = ftpClient.getReplyCode();
      if (FTPReply.isPositiveCompletion(reply)) {
        // Login
        if (ftpClient.login(user, password)) {

          // Set protection buffer size
          ftpClient.execPBSZ(0);
          // Set data channel protection to private
          ftpClient.execPROT("P");
          // Enter local passive mode
          ftpClient.enterLocalPassiveMode();
          ftpClient.logout();
        } else {
          System.out.println("FTP login failed");
        }
        // Disconnect
        ftpClient.disconnect();
      } else {
        System.out.println("FTP connect to host failed");
      }
    } catch (IOException ioe) {
      ioe.printStackTrace();
      System.out.println("FTP client received network error");
    }
  }

but when I run the above code I get:

javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateExpiredException: NotAfter: Thu Aug 30 13:31:23 CEST 2012
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1764)

when it comes to:

  ftpClient.connect(host);

Any ideas on how to connect to a Filezilla server from java code using eg. org.apache.commons.net ?

EDIT:
I have now tried to change to FTPClient (even though that does allow me to setup Explicit TLS):

  FTPClient ftpClient = new FTPClient();
  // Connect to host
  ftpClient.connect(host);
  int reply = ftpClient.getReplyCode();
  if (FTPReply.isPositiveCompletion(reply)) {

    // Login
    boolean login = ftpClient.login(user, password);
    if (login) {
      ftpClient.enterLocalPassiveMode();
      ftpClient.logout();
    } else {
      System.out.println("FTP login failed");
    }

but then login=false and I get: “FTP login failed”. And if I debug the apache source I see the reply code is: 530 = “Not logged in” : http://en.wikipedia.org/wiki/List_of_FTP_server_return_codes

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:53:30+00:00Added an answer on June 16, 2026 at 4:53 pm

    Creating a SSLContext solved the problem:

      SSLContext sslContext = SSLContext.getInstance("TLS");
      TrustManager tm = new X509TrustManager() {
        public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
        }
    
        public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
        }
    
        public X509Certificate[] getAcceptedIssuers() {
          return null;
        }
      };
      sslContext.init(null, new TrustManager[] { tm }, null);
      FTPSClient ftpsClient = new FTPSClient(sslContext);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a remote Music Player Daemon(MPD) server running on a linux machine. I
I have remote logged into my machine and trying to start tomcat server. But,
I have a remote server running SQL Server 9.0.3042, trying to subscribe to a
All, I have an issue with a remote ftp server that has kept me
I have remote server credentials and mysql root password. When I access remote machine
I have a remote server configured on archlinux and I need to install the
We have a remote repository on a linux server. When I work on a
I have a remote actor (client) which is registering with another remote actor (server)
I need to connect to remote server via FTPS (implicit or explicit). I successfully
I have made Remote App .msi paket. Im able to install it to windows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.