3 Replies Latest reply: May 5, 2008 8:27 AM by 843790 RSS

    Connect FTPClient to a IBM 4690 OS Server.

    843790
      Hi,

      I'm facing some problem connectiong to a IBM 4690 OS Server with the FTPClient class from the commons-net-1.4.1 library. It seems it can't read the folder on the server. The problem is that using the FTP client from Internet Explorer is works perfectly.

      Here is my code (kind of hardcoded but it's only to test).
               FTPFile[] files = null;
      
                try {
                     files = listFiles(remoteFolder);
                } catch (ParserInitializationException e) {
                     
                     FTPListParseEngine engine = initiateListParsing("org.apache.commons.net.ftp.parser.EnterpriseUnixFTPEntryParser", remoteFolder);
      
                     if (!engine.hasNext()) {
                          throw new SystemException("No file found.");
                     }
                }
      Here is the ParserInitializationException that it throws:
      org.apache.commons.net.ftp.parser.ParserInitializationException: Unknown parser type: OS 4690 operating system
           at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:118)
           at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2358)
           at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2141)
      ...
      I've tried to use many of the FTPFileListParser available but without success.

      Anyone has an idea of how could I handle the problem? Where could I find a Parser that would works?

      Thanks,


      MJalbert
        • 1. Re: Connect FTPClient to a IBM 4690 OS Server.
          843790
          Hi!

          The problem seems to be from the parser , I suppose that because when I look at the result of a connection to a Windows environment, it list all the files and folders BUT connectiong to a Unix environment, it also list the "." and ".." as directories. I believe the problem is from there but I still don't know how to fix that.

          Anyone ever faces that?

          Thanks in advance,

          MJalbert
          • 2. Re: Connect FTPClient to a IBM 4690 OS Server.
            843790
            Hi,

            Trying and trying, I found that:
                    FTPClientConfig config = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
                    
                    configure(config);
            
                 files = listFiles(remoteFolder);
            Now instead of returning a ParserInitializationException it returns me that an empty array of object. I've tried many folder and even the root but it always return me nothing.

            By the way, my class extends org.apache.commons.net.ftp.FTPClient.

            Please, anyone, I'm sure someone has faced that before.

            Thanks,


            MJalbert
            • 3. Re: Connect FTPClient to a IBM 4690 OS Server.
              843790
              Hi everyone,

              I've finally resolved the problem. The IBM 4690 needs a special parser in order to use the "listFiles()" method.

              If anyone needs the parser, feel free to contact me.


              MJalbert