Hey
Im trying to run ftp-client on unix and after listing directory im trying get files using get(String,String) method. Ive tested the program on Windows XP and it works fine, but on Unix I get following exception:
Exception in java_ftp_loader:
Retrieving by ebid: /n
BEL8903FF6B342E4CFD93E970B0A9B6A47E
java.io.IOException: Unexpected null reply received
at com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java:621)
at com.enterprisedt.net.ftp.FTPClient.validateTransfer(FTPClient.java:868)
at com.enterprisedt.net.ftp.FTPClient.get(FTPClient.java:1194)
at mypackage1.java_ftp_loader.main(java_ftp_loader.java:57)
Unexpected null reply received
java.io.IOException: Unexpected null reply received
Here's the code im using to implement the edtftpj.
public static void main(String[] args)
{
java_ftp_loader java_ftp_loader = new java_ftp_loader();
String host = "**********";
String user = "******";
String password = "*****";
FTPClient ftp = null;
try
{
ftp = new FTPClient(host, 21);
FTPMessageCollector listener = new FTPMessageCollector();
ftp.setMessageListener(listener);
ftp.login(user,password);
FTPFileFactory ffact = new FTPFileFactory(FTPFileFactory.UNIX_STR);
ftp.setFTPFileFactory(ffact);
ftp.setType(FTPTransferType.BINARY);
String[] listaus = ftp.dir("/***/***");
for (int i = 0; i < listaus.length ; i ++)
{
String hak = listaus[i];
System.out.println(listaus[i]);
StringTokenizer tok = new StringTokenizer(hak,"/");
String turha = tok.nextToken();
String turha2 = tok.nextToken();
String ebid = tok.nextToken();
System.out.println("Retrieving by ebid: /n");
System.out.println(ebid);
ftp.get(ebid + ".xml","bills-new/by-ebid/" + ebid +"/data.einvoicexml");
}
The ftp-server which im connecting into is using virtual-directories so thats why im using StringTokenizer to get identifier for file im retrieving. I get the exception-message after listing (it retrieves one file but after that it throws the exception).
Could someone help me with this, and give me some suggestions what could be wrong? I would appreciate that very much.... Thank you :D