• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Frits Walraven
  • Himai Minh

Apache Commons FTPClient not wokring in Red Hat Linux

Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchers,

Iam using apache commons FTPClient (In "commons-net-1.4.1.jar" ). Iam using it to read files and write a file onto a FTP server.

This class works fine in Windows environment, but its not working on linux ( red hat linux) environment. The following snippet code is for reading a file on FTP. This piece of code results to deadlock situation at bolded code.

FTPClient ftpclient = new FTPClient();
ByteArrayOutputStream baos = null;
ByteArrayInputStream bais = null;
try {
// check reply code.
if (!FTPReply.isPositiveCompletion(ftpclient.getReplyCode())) {
return null;
} else {
System.out.println("IN Positive Connection made; Reply code = "
+ ftpclient.getReplyCode());

ftpclient.login(ftpUserId.trim(), ftpPwd.trim());

baos = new ByteArrayOutputStream();
ftpclient.retrieveFile(strConfigFileName.trim(), baos);
bais = new ByteArrayInputStream(baos.toByteArray());

} catch (IOException e) {
} catch (Exception e) {

Hi friends, did anyone face this kind of problem. Please provide me a solution to this. Iam in urgene need.

Thanks in advance,
Posts: 43026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you know it's deadlocked? What else is going on that it could deadlock with?

It may not make a difference here, but I'd advise always to check the return values of methods such as login, changeWorkingDirectory and the other ones.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic