Problem in Apache FTP Client !!!

Discussions

General J2EE: Problem in Apache FTP Client !!!

  1. Problem in Apache FTP Client !!! (1 messages)

    Hello, I am trying to use org.apache.commons.net.ftp.FTPClient to connect to one FTP server and fetching the files! But it is always giving following exception: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/oro/text/regex/MalformedPatternException at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createNTFTPEntryParser(DefaultFTPFileEntryParserFactory.java:184) at FTPTest.main(FTPTest.java:45) Can some body help me there, who have alrwedy faced such problem? Following is the code that I have been trying! import org.apache.commons.net.*; import org.apache.commons.net.ftp.*; import org.apache.commons.net.ftp.parser.*; public class FTPTest { /** * @param args */ public static void main(String[] args) throws Exception { boolean isConnectionAlive = true; FTPClient ftpClient = new FTPClient(); try { ftpClient.connect("mygenuineurl"); System.out.println("Connected to ftp.stacks.com."); System.out.print(ftpClient.getReplyString()); ftpClient.login("myuser", "mypassword"); int replyCode = ftpClient.getReplyCode(); System.out.print(replyCode); System.out.print(ftpClient.getSystemName()); if(!FTPReply.isPositiveCompletion(replyCode)) { ftpClient.disconnect(); System.err.println("FTP server refused connection."); System.exit(0); } while(true) { if(!isConnectionAlive) { break; } FTPFileEntryParser parser = new DefaultFTPFileEntryParserFactory().createNTFTPEntryParser(); FTPListParseEngine engine = ftpClient.initiateListParsing("MLB",parser.getClass().getName()); // have tried following too with expectation that it should take default // implementation and should work. Still does not work. /*FTPListParseEngine engine = ftpClient.initiateListParsing();*/ // forget it. Any ways code never reaches till this point. while (engine.hasNext()) { FTPFile[] files = engine.getNext(1); } // This is what I tried first with expectation // that it would have been worked with out any problem. // but alas !! always giving same exception. //FTPFile[] files = ftpClient.listFiles(); //System.out.println("Number of Files Read : "+ files.length); /*for(FTPFile file : files) { System.out.println(file.getName()); System.out.println(file.getLink()); System.out.println(file.getRawListing()); System.out.println(file.getTimestamp()); }*/ try { Thread.sleep(30000L); } catch (Exception ignored){} } ftpClient.logout(); } catch (Exception e) { e.printStackTrace(); } finally { if(ftpClient.isConnected()) { ftpClient.disconnect(); } } } }
  2. Looks like jakarta-oro.jar is not present in your classpath