Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.1k views
in Java FTP by (160 points)
/***********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

2 Answers

0 votes
by (162k points)
You will need to recompile to use 1.5.4 - the put() method signatures have changed to return a String.
0 votes
by (160 points)
i just made a new weblogic domain and my problem is solved and i m using the old varsion of jar. anyways thanx for replying

Categories

...