Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in connecting to FTP server

 
Manupriya Sinha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using apache commons library for connecting to FTP server. Please find below the code -

Now my problem is - I do not get any exception but still ftp.getReplyString() returns '530 Login incorrect.'. Can you please help me with this.

We are using port 22 on the ftp server. Can that be the reason for this error?

I modified my code and included port as well while connecting, as folllows -
ftp.connect(addr, 22);

but now I am getting an exception -
Server Reply: SSH-1.99-OpenSSH_3.6.1p2
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:284)
at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:335)
at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:550)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:142)
at com.novus.file.ftp.JakartaWrapperTest.main(JakartaWrapperTest.java:26)

Is it to do something with Active FTP or Passive FTP?

Thanks,
Manupriya

JCE - Please Use Code Tags
[ August 19, 2008: Message edited by: Joe Ess ]
 
Joe Ess
Bartender
Posts: 9300
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Manupriya Sinha:

Server Reply: SSH-1.99-OpenSSH_3.6.1p2


This reply leads me to believe that you are connecting to an SSH service, not FTP. Port 22 is usually bound to an SSH server. Port 21 is typical for an FTP server.
Have you tried connecting with an FTP client?
Are you supposed to be using SFTP (FTP over SSH)?
 
Manupriya Sinha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Joe !!

I will try code for sftp now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic