commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Cole" <sc...@camsbycbs.com>
Subject RE: Commons-net FTP and AIX 5.3 FTP Server
Date Fri, 23 Apr 2010 20:28:43 GMT
You said you already tried changing active/passive mode. Did you set after
login, just before the list() method?

    if (passiveMode){
      ftpClient.enterLocalPassiveMode();
    }else{
      ftpClient.enterLocalActiveMode();
    }
    ftpClient.list();


-----Original Message-----
From: Ricardo Duval [mailto:rdg.duval@ibest.com.br] 
Sent: Friday, April 23, 2010 3:32 PM
To: Commons Users List
Subject: Re: Commons-net FTP and AIX 5.3 FTP Server

Steve,

I had already tried setting this parameter manually (on System class). Just
to be sure, now follow the results passing it on command line execution
(Maven test):

C:\devel\workspace-nfe\ftp-proof>mvn -Dtest=FtpCommonsNetTest
-Djava.net.preferIPv4Stack=true test
...
Results :
Tests in error:
  testRiscf80(testes.integracao.FtpCommonsNetTest)
Tests run: 3, Failures: 0, Errors: 1, Skipped: 2
...

And these are the individual test results:

Tests run: 3, Failures: 0, Errors: 1, Skipped: 2, Time elapsed: 0.25 sec <<<
FAILURE!
testRiscf80(tests.integrated.FtpCommonsNetTest)  Time elapsed: 0.156 sec
<<< ERROR!
org.apache.commons.net.MalformedServerReplyException: Could not parse
response code.
Server Reply: : The socket name is not available on this system.
    at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:316)
    at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:491)
    at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:533)
    at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:582)
    at org.apache.commons.net.ftp.FTP.quit(FTP.java:790)
    at org.apache.commons.net.ftp.FTPClient.logout(FTPClient.java:759)
    ...

Based on this test:

    @Test
    public final void testRiscf80() throws Exception {
        FTPClient ftp = new FTPClient();
        FileInputStream fis = null;
        try {
            ftp.connect(SOME_AIX_HOST);
            ftp.login(SOME_USER, SOME_PASS);
            ftp.changeWorkingDirectory("/riscf80/some/remote/path");
            File file = new File(PATH, FILE_NAME);
            fis = new FileInputStream(file);
            ftp.storeFile(fileName, fis);
        } finally {
            ftp.logout();
            ftp.disconnect();
            if(fis != null) { fis.close(); }
        }
    }

I double checked to see if the preferIPv4Stack was there on the execution
properties, and I also tried passing java.net.preferIPv6Stack=false, but for
no avail.

Thanks

2010/4/23 Steve Cole <scole@camsbycbs.com>

> The exception is occurring when a QUIT command is sent, simply because it
> failed to parse the server reply. The actual problem appears to be a
> connection issue. It can't open the data connection. That's why list()
> failed. Have you tried setting the property java.net.preferIPv4Stack=true?
>
>
> -----Original Message-----
> From: Ricardo Duval [mailto:rdg.duval@ibest.com.br]
> Sent: Friday, April 23, 2010 1:46 PM
> To: Commons Users List
> Subject: Re: Commons-net FTP and AIX 5.3 FTP Server
>
> Martin,
>
> Unfortunately I already tried with ASCII type. The first example I sent I
> didn't change the default FTP transfer type which is ASCII.
>
> Using some other cliente I can easily upload files, even using other FTP
> client libs like edtFTPj. The same set of commands using the MS FTP client
> (DOS) gave the following result:
>
> C:\Documents and Settings\rduval.FCD>ftp SOME_IP
> Connected to SOME_IP.
> 220 riscf80 FTP server (Version 4.2 Fri May 2 12:48:10 CDT 2008) ready.
> User (SOME_IP:(none)): SOME_USER
> 331 Password required for SOME_USER.
> Password:
> 230-Last unsuccessful login: Fri Apr 23 13:55:51 GRNLNDST 2010 on ftp from
> SOME_HOME
> 230-Last login: Fri Apr 23 14:22:06 GRNLNDST 2010 on ftp from SOME_HOME
> 230 User SOME_USER logged in.
> ftp> binary
> 200 Type set to I.
> ftp> pwd
> 257 "/riscf80/some/folder" is current directory.
> ftp> cd ../nfe
> 250 CWD command successful.
> ftp> pwd
> 257 "/riscf80/some/nfe" is current directory.
> ftp> ls
> 200 PORT command successful.
> 150 Opening data connection for ..
> lost+found
> 61438248003904006
> 61438248004625033
> ... (Several files and folders)
> 61438248005605033
> 226 Transfer complete.
> ftp: 639 bytes received in 0,05Seconds 13,60Kbytes/s.
> ftp> quit
> 221 Goodbye.
>
> I think the problem is something in the lib itself, but I tried to debug
it
> and couldn't find a reason for that.
>
> R. Duval
>
> 2010/4/23 Martin Gainty <mgainty@hotmail.com>
>
> >
> > one possible problem is
> > type i (if your sending/receiving machine is EBCDIC and
> >                the file contains non-display data, e.g., COMP-3);
> > i know of one system that sends/receives EBCDIC.. an old ibm mainframe
> that
> > the army abandoned in Saigon in 75..all other computer systems
> send/receive
> > and process in ascii
> >
> > i would strongly suggest setting type='a'
> > http://www.ucop.edu/irc/campus_specs/ftp/aixftp.html
> >
> > what happens when you use issue the same series of commands at
> command-line
> > prompt?
> > Martin Gainty
> > ______________________________________________
> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> >
> > > Date: Fri, 23 Apr 2010 11:55:49 -0300
> > > Subject: Commons-net FTP and AIX 5.3 FTP Server
> > > From: rdg.duval@ibest.com.br
> > > To: user@commons.apache.org
> > >
> > > Hello,
> > >
> > > Let me explain what's happening: I have no problems connecting and
> > uploading
> > > files to Linux, Windows or even SCO (yes, it still exists) FTP
servers,
> > but
> > > when I try to execute a simple command using FTPClient to AIX 5.3 I
got
> > the
> > > following exception:
> > >
> > >    1.
> > >    org.apache.commons.net.MalformedServerReplyException: Could not
> > > parse response code.
> > >    2. Server Reply: : The socket name is not available on this system.
> > >    3.     at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:316)
> > >    4.     at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:491)
> > >    5.     at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:533)
> > >    6.     at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:582)
> > >    7.     at org.apache.commons.net.ftp.FTP.quit(FTP.java:790)
> > >    8.     at
> > org.apache.commons.net.ftp.FTPClient.logout(FTPClient.java:759
> > >    )
> > >    9.
> > >        at
> > testes.integracao.FtpCommonsNetTest.testRiscf80(FtpCommonsNetTest.java:
> > >    27)
> > >    10.         ...
> > >
> > > ... The code that generates the stack above is just that:
> > >
> > >    1.     @Test
> > >    2.     public final void testRiscf80() throws Exception {
> > >    3.         FTPClient ftp = new FTPClient();
> > >    4.         try {
> > >    5.             ftp.connect(AIX_HOST_IP);
> > >    6.             ftp.login(AIX_USER, AIX_PASSWD);
> > >    7.             ftp.changeWorkingDirectory(
> > >    "/riscf80/path/to/uploaded/files");
> > >    8.             File file = new File("some-dummy-file.gz");
> > >    9.             FileInputStream fis = new FileInputStream(file);
> > >    10.             ftp.storeFile(fileName, fis);
> > >    // Line where exception occurs
> > >    11.         } finally {
> > >    12.             ftp.logout();
> > >    13.             ftp.disconnect();
> > >    14.         }
> > >    15.     }
> > >
> > > That was intriguing,
> > > so I performed some research and reached the following results
printing
> > all
> > > responses from the server while was just trying to list some folder
> > files:
> > >
> > >    1.     @Test
> > >    2.     public void testListingRiscf80Internal() throws Exception {
> > >    3.         FTPClient client = new FTPClient();
> > >    4.         try {
> > >    5.             client.connect(AIX_HOST_IP);
> > >    6.             System.out.println(client.getReplyString());
> > >    7.             if(client.login(AIX_USER, AIX_PASSWD)) {
> > >    8.                 System.out.println(client.getReplyString());
> > >    9.                 client.setFileType(FTPClient.BINARY_FILE_TYPE);
> > >    10.                 System.out.println(client.getReplyString());
> > >    11.                 client.pwd();
> > >    12.                 System.out.println(client.getReplyString());
> > >    13.                 client.list(); // This generates the 425 reply
> > code
> > >    14.                 System.out.println(client.getReplyString());
> > >    15.             }
> > >    16.         } finally {
> > >    17.             client.logout(); // Where exception is thrown
> > >    18.             client.disconnect();
> > >    19.         }
> > >
> > > And these are the sysout results:
> > >
> > > 220 riscf80 FTP server (Version 4.2 Fri May 2 12:48:10 CDT 2008)
ready.
> > > 230-Last unsuccessful login: Wed Apr 21 18:35:18 GRNLNDST 2010 on ssh
> > from
> > > SOME_IP
> > > 230-Last login: Thu Apr 22 19:41:45 GRNLNDST 2010 on ftp from
SOME_HOST
> > > 230 User SOME_USER logged in.
> > > 200 Type set to I.
> > > 257 "/riscf80/some/folder" is current directory.
> > > 425      No data connection
> > >
> > > Some additional data may be useful to understand this issue:
> > > - There is no firewall between the client and the FTPServer
> > > - I've tried other client libraries (like edtFTPJ, ftp4j), they work
> but
> > their
> > > performance is very poor compared to commons-net
> > > - I couldn't find an explicit way to set preference on ipv4 stack over
> > ipv6
> > > stack in commons-net lib
> > > I've also tried to enable the remote passive mode for no avail. Tried
> > > several different things, like disabling the remote verification, and
> > > nothing made the trick. It's a very specific problem, but any thoughts
> > would
> > > be greatly appreciated.
> > >
> > > Thanks in advance
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message