Apache Commons Net - FTP Problem
843790Mar 21 2007 — edited Mar 22 2007Hi All!
I would like to ask regarding Apache Commons Net - FTP: I am having an exception indicating: (After successful connection of FTP Server)
Exception in thread "main" java.lang.NoClassDefFroundError: org/apache/oro/text/regex/MalformedPatternException
at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createUnixFTPEntryParser(DefaultFTPFileEntryParserFactory.java:169)
at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:94)
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2358)
at org.apache.commons.net.ftp.FTPClientlistFiles(FTPClient.java:2141)
at org.apache.commons.net.ftp.FTPClientlistFiles(FTPClient.java:2188)
at FTP_Sample.getFiles(FTP_Sample.java:17)
at FTP_Sample.main(FTP_Sample.java:55)
the code that is causing this exception is:
FTPFile [] files=ftp.listFiles();
Complete code of the Simple Program:
import org.apache.commons.net.ftp.*;
import java.util.*;
import java.text.*;
import java.io.*;
class FTP_Sample{
public void getFiles(String server, String un, String pw, String dir, String locDir, Calendar start, Calendar end){
try{
FTPClient ftp=new FTPClient();
ftp.connect(server);
ftp.login(un,pw);
System.out.println("Connected to " + server + "!");
System.out.println(ftp.getReplyString());
ftp.changeWorkingDirectory(dir);
FTPFile [] files=ftp.listFiles();
//Codes for getting files here...
ftp.logout();
ftp.disconnect();
}catch(Exception e){ e.printStackTrace(); }
}
public static void main(String args[]) throws IOException{
String server="10.101.216.119";
String un="door";
String pw="knock";
String dir="/appsvg3/i2doleproj/prod/intg/clogFileServer/clog_datafiles/ip/dp/dpLoadingErrors/";
String locDir="C:\\I2";
Calendar start=Calendar.getInstance();
Calendar end=Calendar.getInstance();
start.set(2007,03,15);
end.set(2007,03,31);
FTP_Sample ftps=new FTP_Sample();
ftps.getFiles(server,un,pw,dir,locDir,start,end);
System.out.println("FTP Transfer - Done!");
}
}
Any Idea how to solve this problem?
Thank you and God Bless,
MaDz