/***********FTPClient object creation code****************/
try {
ftpClient.setRemoteHost(host);
ftpClient.setRemotePort(21);
ftpClient.connect();
ftpClient.setTimeout(1500);
ftpClient.login(userBean.getUsername(), userBean.getPassword());
}catch (Exception e) {
System.out.println("Exception in object creation : " +
e.getMessage());
e.printStackTrace();
}
// File upload function
public boolean uploadFiles(List listOfFileMap) {
try {
Indexing index=new Indexing();
for (int i = 0; i < listOfFileMap.size(); i++) {
Map map=(Map)listOfFileMap.get(i);
FormFile file = (FormFile)map.get("file");
String comment=(String)map.get("comment");
if (file != null && !file.getFileName().equalsIgnoreCase(""))
{
String entryTodelete=ftpClient.pwd() + "/" + file.getFileName();
/* if(ftpClient.exists(file.getFileName()))
ftpClient.delete(file.getFileName());
if (entryTodelete.startsWith("//"))
index.deleteFiles(entryTodelete.substring(1));
else
index.deleteFiles(entryTodelete);*/
byte[] contents = file.getFileData();
ftpClient.setType(FTPTransferType.BINARY);
ftpClient.put(contents, file.getFileName(),true);
}
}
return true;
} catch (Exception e) {
System.out.println("====Error in uploadFiles===");
e.printStackTrace();
return false;
}
****************************error******************************
Caused by: java.lang.NoSuchMethodError: com.enterprisedt.net.ftp.FTPClient.put([BLjava/lang/String;)V
at com.componence.portlets.components.vdrive.filesystem.FtpVFS.uploadFiles(FtpVFS.java:776)
right now i m using the "edtftpj.jar" not the latest one my applicaion code was running whith this function and then i to use the FTPClient.exisit() function i download the latest jar "edtftpj-1.5.4.jar" then i got some connection reset exception then again i comment the code changes and put the old jar "edtftpj.jar" again in my class path now new jar no where exisit . i dont why this error occur in put function
Caused by: java.lang.NoSuchMethodError: com.enterprisedt.net.ftp.FTPClient.put([BLjava/lang/String;)V
at com.componence.portlets.components.vdrive.filesystem.FtpVFS.uploadFiles(FtpVFS.java:776)
even all functions working properly like list the file in pwd(),delete, rename, download but
the problem occur in put functions.
if we dont set time out then the default time out is 0 its infite i guess then is there really need to setTimeOut ()
some times i got error connection reset .
reply soon its very urgent
regards