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 8850671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:57:22+00:00 2026-06-14T12:57:22+00:00

I am trying to connect to an FTPS server using the commons-net library. I

  • 0

I am trying to connect to an FTPS server using the commons-net library. I can connect properly but when I try to list the files, I get the error “534 Policy requires SSL.”

import java.io.IOException;
import java.net.SocketException;

import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPSClient;
import org.apache.commons.net.util.TrustManagerUtils;

public class Test {

    public static void main(String[] args) throws SocketException, IOException {
        FTPSClient c = new FTPSClient("SSL", false);
        c.setTrustManager(TrustManagerUtils.getValidateServerCertificateTrustManager());
        c.connect("10.10.6.225", 21);
        c.login("ftpuser", "Passw0rd");
        c.changeToParentDirectory();
        for (String s : c.getReplyStrings()) {
            System.out.println(s);
        }

        c.listFiles();
        for (String s : c.getReplyStrings()) {
            System.out.println(s);
        }
        for (FTPFile f : c.listFiles("/TestFolder")) {
            System.out.println("file");
            System.out.println(f.getName());
        }
        c.disconnect();
    }

}
  • 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-14T12:57:23+00:00Added an answer on June 14, 2026 at 12:57 pm

    After logging in:

    c.login("ftpuser", "Passw0rd");
    

    try adding:

    c.setFileType(FTP.BINARY_FILE_TYPE);
    c.execPBSZ(0);  // Set protection buffer size
    c.execPROT("P"); // Set data channel protection to private
    c.enterLocalPassiveMode();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to connect to exchange 2010 SP1 using EWS & VB.Net. When i try
I am trying to connect to a MySQL Server using JDBC tool in java
I'm trying to connect to a FTP using Apaches FTPSClient but I keep getting
I'm using cURL to connect to a SSL server to recive and send XML-files
When trying to connect to a .mdf databse in ASP.NET (using c#) I am
Trying to connect to a SQL Server 2005 instance remotely but getting the following
Im trying to connect to a mysql database on my web server, but I
I'm trying connect me to database MySQL server but the console show me ERROR
Im trying to connect to a POP3 server via imap_open imap_open('{mail.domain.com:995/pop3/tls}INBOX', 'user@domain.com', 'password'); But
I'am trying to connect to a remote server over ssh2 using the lib ch.ethz.ssh2.Connection

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.