Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.8k views
in Java FTP by (160 points)
Hello to everybody!


I have a big problem with the enterprisedt ftp.
I have a customer with a data transfer batch application which was running smooth
since 4.5 years without any trouble. The data is transfered to another company via internet,
both systems are protected by firewalls of course. On the day when the trouble starts my customer
had a system crash due to power failure and the data receiving company restarted their firewall due to unknown reasons.



Heres the code snippet which throws an exception

 FTPClient ftp = new FTPClient();
     StringBufferInputStream bufStream = new StringBufferInputStream(buf);     
  
        ftp.setRemoteHost(Main.FtpHost);
        FTPMessageCollector listener = new FTPMessageCollector();
        ftp.setMessageListener(listener);  
        ftp.setConnectMode(FTPConnectMode.ACTIVE);
        ftp.connect();
        ftp.login(Main.FtpUser, Main.FtpPasswd);
        ftp.setType(FTPTransferType.ASCII);
        if (!Main.FtpDir.equals("")) {
            ftp.chdir(Main.FtpDir);
        };
        ftp.put(bufStream, fileName);
        ftp.quit();





A 'java.net.SocketException: Connection reset' is thrown by ftp.quit.
The upload seems to be ok (!!), but unfortunally the exception causes a database rollback .


I have tested the application with another ftp-server and everything works !!!
It is very interisting that from the unix shell of the sending machine the ftp to the same adress works well.

Does anyone have an idea what could cause an exception at this point, especially firewall related?
How can ftp.quit() throw an exception ??

Thank you
Volker

3 Answers

0 votes
by (162k points)
post the relevant bit of the log file at DEBUG level
0 votes
by (160 points)
Hello,

thank you for your response!

Here is the output with Level=Debug


DEBUG [com.enterprisedt.net.ftp.FTPClient] 6 Jul 2009 09:18:37.609 : Connecting to /111.222.333.444:21
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.661 : 220-Welcome to Pure-FTPd.
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.661 : 220-You are user number 1 of 30 allowed.
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.661 : 220-This is a private system - No anonymous login
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.662 : 220 You will be disconnected after 15 minutes of inactivity.
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.662 : ---> USER xxxxx
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.683 : 331 User xxxxx OK. Password required
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.683 : ---> PASS ********
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.728 : 230-User xxxxx has group access to:  kunden
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.765 : 230-This server supports FXP transfers
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.765 : 230 OK. Current restricted directory is /
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.765 : ---> TYPE A
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.800 : 200 TYPE is now ASCII
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.802 : ---> PORT 132,148,20,185,175,15
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.823 : 200 PORT command successful
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.823 : ---> STOR 46427.asc
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.864 : 150 Connecting to port 41319
DEBUG [com.enterprisedt.net.ftp.FTPClient] 6 Jul 2009 09:18:37.865 : Transferred 748 bytes to remote host
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.895 : 226-File successfully transferred
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.895 : 226 0.026 seconds (measured here), 27.84 Kbytes per second
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.895 : ---> QUIT
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 6 Jul 2009 09:18:37.916 : 221-Goodbye. You uploaded 1 and downloaded 0 kbytes.
java.net.SocketException: Connection reset




The exception is thrown by ftp.quit.
I haved catched it in the moment but it is kind of a hack because I dont't know what's going on.

by
Volker
0 votes
by (162k points)
Perhaps the server is just severing the connection abruptly once you send the QUIT. In that case all you can do is catch the exception from quit(). Which isn't that big a deal actually ....

Categories

...