I have the strangest problem. I'm connection to a server (Linux machine) within our intranet using Apache's commons package. When I execute a simple java code on my Windows XP machine everything works as it should but when I use the code as a package for a servlet code (running on Linux) things goes wrong. I get the message "Connection closed without indication.", so it does connect but it drops the connection immediately. I never get the chance to login to the server. I can connect to the host by typing "ftp nnn.nnn.nnn.nnn" in the Linux command promt, so I'm very confused here.
Maybe I'm forgetting to make a setting or something.
Thanks a million for any help given!
Maybe I'm forgetting to make a setting or something.
Thanks a million for any help given!
Code:
String host = "nnn.nnn.nnn.nnn";
String path = "some/path";
String username = "username";
String password = "password";
FTPClient ftp = new FTPClient();
FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
ftp.configure(conf);
ftp.connect(host); // This is where it goes wrong!
ftp.login( username, password );