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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:30:39+00:00 2026-06-05T17:30:39+00:00

When using ftpClient.connect with an existing host who has no ftp service active, timeout

  • 0

When using ftpClient.connect with an existing host who has no ftp service active, timeout occurs only after 5 minutes, which is much too long.

I tried setting diverse timeouts (setDefaultTimeout, setDataTimeout) which did not change anything.

FtpClient inherits from SocketClient which has a setConnectTimeout method, but when I use this I get a java.lang.NoSuchMethodError: org/apache/commons/net/ftp/FTPClient.setConnectTimeout when running it. This seems to be because of some J2SW 1.2 compatibility, as described in Commons-net FAQ:

Q: How can I set a connection timeout? http://wiki.apache.org/commons/Net/FrequentlyAskedQuestions

They suggest to implement an own SocketFactory creating objects from an extended Socket class using a specific timeout. However, when trying to use ftpClient.setSocketFactory I also get a java.lang.NoSuchMethodError.

Any help how I can reduce the connect timeout?

  • 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-05T17:30:41+00:00Added an answer on June 5, 2026 at 5:30 pm

    Though there is possible solution for that older version of Commons Net library, I suggest to figure out why wrong version of Commons Net is used. To do this you may include following code to the place where FTPClient is used in your webapp:

    FTPClient ftpClient = ...;
    if(ftpClient.getClass().getClassLoader() instanceof java.net.URLClassLoader) {
        URL[] urls = ((java.net.URLClassLoader) ftpClient.getClass().getClassLoader()).getURLs();
        // log these urls somewhere and check - these are urls from where your FTPClient may be loaded from
    }
    

    In case if FTPClient is loaded not by java.net.URLClassLoader then it may get more complicated to check the classpath, though it should not be a problem.

    Hope this helps…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using FTPClient con = new FTPClient(); try { con.connect(HOST); if (con.login (LOGIN, PASSWORD))
I am able to have my application upload files via FTP using the FTPClient
I'm using the Commons Net FTPClient class to periodically poll an ftp site and
We are using the following Apache Commons Net FTP code to connect to an
I'm using FTPClient (org.​apache.​commons.​net.​ftp.​FTPClient) to upload some files to a FTP server. I need
I'm using Apache Commons' FTPClient to talk to an FTP server and upload some
Due to some firewall issues, we need to do FTP using active mode (i.e.
I'm transferring a file using ftp in Delphi. I am able to connect to
I download an image file from an FTP Server using FTPClient . My look
I'm trying to connect to a FTP using Apaches FTPSClient but I keep getting

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.