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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:35:09+00:00 2026-06-10T20:35:09+00:00

Having a problem with FTP transfer from our server (FileZilla, setup in passive mode)

  • 0

Having a problem with FTP transfer from our server (FileZilla, setup in passive mode) to our web application deployed on a CentOS ec2 instance.
Manually testing with wget and ftp from the instance, we are able to authenticate, change directory, and fetch files. However, our ec2 deployed webapp does not fetch the files, although it DOES authenticate and navigate successfully.
FTP upload in our app works fine on our LAN, and also testing externally (dev laptop on wireless tether, no VPN)

We have written more focused unit tests as part of this and are currently reproducing the failure and success cases with the following, deployed from ec2 (failure) and non-ec2 (success):

import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;

public class FTPTest {

    @Test
    public void testFTPAccess() throws IOException {
        String fileUrl = "ftp://username:password@ftp.site.com/path/to/resource.txt";
        URL url = new URL(fileUrl);
        URLConnection uc = url.openConnection();
        InputStream is = uc.getInputStream();
        ByteArrayOutputStream out = new ByteArrayOutputStream(1024*10);
        com.google.common.io.ByteStreams.copy(is,out);
        System.out.println(new String(out.toByteArray()));
    }
}

FileZilla server logfile is identical through login, USER, PASS, CWD, but differs once transfer begins.

Success case is as follows:

(000216) 8/28/2012 10:47:20 AM - (not logged in) (external IP)> Connected, sending welcome message...
(000216) 8/28/2012 10:47:20 AM - (not logged in) (external IP)> 220-FileZilla Server version 0.9.24 beta
(000216) 8/28/2012 10:47:20 AM - (not logged in) (external IP)> 220 Connected to server FTP!
(000216) 8/28/2012 10:47:20 AM - (not logged in) (external IP)> USER ftpUser
(000216) 8/28/2012 10:47:20 AM - (not logged in) (external IP)> 331 Password required for ftpUser
(000216) 8/28/2012 10:47:20 AM - (not logged in) (external IP)> PASS *********
(000216) 8/28/2012 10:47:20 AM - ftpUser (external IP)> 230 Logged on
(000216) 8/28/2012 10:47:20 AM - ftpUser (external IP)> TYPE I
(000216) 8/28/2012 10:47:20 AM - ftpUser (external IP)> 200 Type set to I
(000216) 8/28/2012 10:47:20 AM - ftpUser (external IP)> CWD DPS
(000216) 8/28/2012 10:47:20 AM - ftpUser (external IP)> 250 CWD successful. "/DPS" is current directory.
(000216) 8/28/2012 10:47:20 AM - ftpUser (external IP)> CWD DP276
(000216) 8/28/2012 10:47:20 AM - ftpUser (external IP)> 250 CWD successful. "/DPS/DP276" is current directory.
(000216) 8/28/2012 10:47:21 AM - ftpUser (external IP)> PASV ALL
(000216) 8/28/2012 10:47:21 AM - ftpUser (external IP)> 227 Entering Passive Mode (FTP Server IP4,190)
(000216) 8/28/2012 10:47:21 AM - ftpUser (external IP)> PASV
(000216) 8/28/2012 10:47:21 AM - ftpUser (external IP)> 227 Entering Passive Mode (FTP Server IP4,191)
(000216) 8/28/2012 10:47:21 AM - ftpUser (external IP)> RETR sales.txt
(000216) 8/28/2012 10:47:21 AM - ftpUser (external IP)> 150 Connection accepted
(000216) 8/28/2012 10:47:21 AM - ftpUser (external IP)> 226 Transfer OK
(000216) 8/28/2012 10:47:21 AM - ftpUser (external IP)> QUIT
(000216) 8/28/2012 10:47:21 AM - ftpUser (external IP)> 221 Goodbye
(000216) 8/28/2012 10:47:21 AM - ftpUser (external IP)> disconnected.

Failure case:

(000217) 8/28/2012 11:25:11 AM - (not logged in) (ec2 Instance IP)> Connected, sending welcome message...
(000217) 8/28/2012 11:25:11 AM - (not logged in) (ec2 Instance IP)> 220-FileZilla Server version 0.9.24 beta
(000217) 8/28/2012 11:25:11 AM - (not logged in) (ec2 Instance IP)> 220 Connected to server FTP!
(000217) 8/28/2012 11:25:11 AM - (not logged in) (ec2 Instance IP)> USER ftpUser
(000217) 8/28/2012 11:25:11 AM - (not logged in) (ec2 Instance IP)> 331 Password required for ftpUser
(000217) 8/28/2012 11:25:11 AM - (not logged in) (ec2 Instance IP)> PASS *********
(000217) 8/28/2012 11:25:11 AM - ftpUser (ec2 Instance IP)> 230 Logged on
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> TYPE I
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> 200 Type set to I
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> CWD DPS
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> 250 CWD successful. "/DPS" is current directory.
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> CWD DP276
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> 250 CWD successful. "/DPS/DP276" is current directory.
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> EPSV ALL
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> 229 Entering Extended Passive Mode (|||1318|)
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> EPSV
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> 229 Entering Extended Passive Mode (|||1319|)
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> EPRT |1|ec2 internal IP|37245|
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> 200 Port command successful
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> RETR products.txt
(000217) 8/28/2012 11:25:12 AM - ftpUser (ec2 Instance IP)> 150 Opening data channel for file transfer.
(000217) 8/28/2012 11:25:23 AM - ftpUser (ec2 Instance IP)> 425 Can't open data connection.
  • 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-10T20:35:10+00:00Added an answer on June 10, 2026 at 8:35 pm

    The success case uses passive mode while the failure case uses extended passive mode. You may have a hard time fine tuning the FTP connection using a plain URLConnection. I strongly suggest using a java client library instead, such as Apache Commons Net. You will find an FTP example on the home page.

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

Sidebar

Related Questions

I am having a problem uploading files with FTP from my iPhone app. I
I'm having a problem with my server at work, it's not letting me access
I want to download a huge file from an ftp server in chunks of
I am having problem creating a new directory inside my FTP using mkdir, here
I'm having some trouble sending a file by ftp from my BizTalk 2006RC. The
Having problem with my application, I seem to be new in ios. My project
Having problem to open form in new window, script is pulled from external service.
I having problem managed thread parallel in console application. I am running 10 threads
Im having problem in importing hotmail contacts from hotmail in php it simple give
I have an application where I am sending image data on server through ftp

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.