commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbre...@wi.rr.com (Jeffrey D. Brekke)
Subject Re: FTPClient listFiles command failing
Date Thu, 02 Oct 2003 12:19:03 GMT

Maybe related to being behind a firewall?  Can you use regular ftp
tools and are you using a passive connection?

>>>>> On Wed, 01 Oct 2003 12:26:34 -0600, Kris Nuttycombe <Kris.Nuttycombe@noaa.gov>
said:

> Hello, all - any help is appreciated.  I'm having difficulty using
> the commons.net.ftp.FTPClient when attempting to get a file
> list. The client connects correctly and I can issue CWD commands
> without difficulty, but as soon as I issue listFiles() or nlst() it
> fails with the reply string "Unable to build data connection:
> Connection timed out"

> Does anyone have an idea of where I should start looking to fix
> this?

> Thanks,

> Kris Nuttycombe

> Here is some debugging output:

> 0 [main] DEBUG gov.noaa.nosa.argo.ArgoReader - 220
> zeus.aoml.noaa.gov FTP server ready 116 [main] DEBUG
> gov.noaa.nosa.argo.ArgoReader - 230 Anonymous access granted,
> restrictions apply.  167 [main] DEBUG gov.noaa.nosa.argo.ArgoReader
> - 250 CWD command successful.  170 [main] DEBUG
> gov.noaa.nosa.argo.ArgoReader - FTP connection successfully
> established to ftp.aoml.noaa.gov/phod/pub/ARGO_FTP/argo/nc/aoml 170
> [main] DEBUG gov.noaa.nosa.argo.ArgoReader - FTP Data connection
> mode: 0 java.io.IOException: FTP client could not obtain file list :
> 425 Unable to build data connection: Connection timed out


> Here is the code that generated it:

>                 client.connect(host);
> log.debug(client.getReplyString());
> if(!FTPReply.isPositiveCompletion(client.getReplyCode())) { throw
> new IOException("FTP server at host " + host + " refused
> connection.");
>                 }
>                              client.login(user, password);
> log.debug(client.getReplyString());
> if(!FTPReply.isPositiveCompletion(client.getReplyCode())) { throw
> new IOException("FTP login failed for user anonymous: " +
> client.getReplyString());
>                 }
>                              client.changeWorkingDirectory(path);
> log.debug(client.getReplyString());
> if(!FTPReply.isPositiveCompletion(client.getReplyCode())) { throw
> new IOException("FTP client could not change to remote directory " +
> path + ": " + client.getReplyString());
>                 }
>                              log.debug("FTP connection successfully
> established to " + host + path); log.debug("FTP Data connection
> mode: " + client.getDataConnectionMode()); FTPFile[] files =
> client.listFiles(path);
> if(!FTPReply.isPositiveCompletion(client.getReplyCode())) { throw
> new IOException("FTP client could not obtain file list : " +
> client.getReplyString());
>                 }




> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org

-- 
=====================================================================
Jeffrey D. Brekke                                   jbrekke@wi.rr.com
Wisconsin,  USA                                     brekke@apache.org
                                                    ekkerbj@yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message