Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.1k views
in Java FTP by (160 points)
the code( in a web application to use ftp transefer files to the ftp server) below can run correctly on windows,linux but on solaris

when on solaris it encounter a java.lang.Error(program need not to process and I don't know how to handle it ,not a exception ) when program runs to 'new FileTransferClient();' ,I find code from this statement don't run because the Error occured at 'new' point


   public String upLoad(String pathname){    
       FileTransferClient fc = null;
       String filename = "";
       try{                

          filename = pathname.substring(pathname.lastIndexOf(fs) + 1);   
          
          fc = new FileTransferClient(); //program abort at this point
                 
          fc.setRemoteHost(FTP_HOST);          
          fc.setUserName(FTP_USER);          
          fc.setPassword(FTP_PWD);            
          fc.connect();                   

          filename = fc.uploadFile(pathname, filename);
         
          File del = new File(pathname);             
          boolean sc = false;
          if(del.exists()){
             sc = del.delete();
              Logger.info("fix-detect-upLoad--sc.delete(): ", "deleted");             
          }
          if(!sc){
             Logger.error(MissionDAO.class.getName(), "not deleted" );
          }
       }catch(Exception e){
          e.printStackTrace();
         Logger.error(MissionDAO.class.getName(), "failed " + e.getMessage());          
       }
       return filename;
    }

2 Answers

0 votes
by (51.6k points)
This sounds like a class-path error. Please check your class-path. In particular, make sure the edtftpj.jar only appears once. If it still doesn't work then please post your class-path here.

- Hans (EnterpriseDT)
0 votes
by (160 points)
This sounds like a class-path error. Please check your class-path. In particular, make sure the edtftpj.jar only appears once. If it still doesn't work then please post your class-path here.

- Hans (EnterpriseDT)



thank you for your help!!

both the soloris and linux does not set the class-path variable(I just put a edtftpj.jar under WEB-INF/lib folder of my web project )it works well on the linux but
soloris abort and a java.lang.Error catched in the method which call the 'upload' method.

and today I test with the alternate solution ( sun.net.ftp.FtpClient) no problem occured on soloris linux or windows,that confused me a lot

Categories

...