Search This Blog

11 August 2009

FTPConnectionClosedException: Connection closed without indication

After installing the ftp server yesterday, I was trying to connect to it with the commons-net library.  Unfortunately it kept failing:

org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
    at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:297)
    at org.apache.commons.net.ftp.FTP.getReply(FTP.java:619)
    at org.apache.commons.net.ftp.FTPClient.completePendingCommand(FTPClient.java:1244)
    at org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1301)

As download worked from the browser, I thought this kinda odd.  Looking a little closer, I decided to manually try the steps from the command line and see if I could figure out what was going on.

I ftp'd in and did the same commands I was doing from Java (passive, binary, etc).

When I tried to 'get ' I saw:


150 Opening BINARY mode data connection for aopalliance-1.0.jar (6371 bytes).
421 Service not available, remote server has closed connection
ftp> 

Since I had found through my debugging that after the exception, the 150 FILE_STATUS_OK was the last reply I got; I looked up 421.  It appears that there is a current bug on OpenSolaris that causes this behavior.

So here's the workaround (for the setup I did yesterday):

cp /lib/libsendfile.so.1 /home/ftp/lib
chown root:bin /home/ftp/lib/libsendfile.so.1
svcadm restart ftp

Everything works beautifully now :)

3 comments:

  1. org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
    at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:253)
    at org.apache.commons.net.ftp.FTP.getReply(FTP.java:523)
    at org.apache.commons.net.ftp.FTPClient.completePendingCommand(FTPClient.java:1225)
    at org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1282)


    I am getting the same exception but in Linux.
    tell me the what are the steps needs to be followed

    ReplyDelete
    Replies
    1. Go to this link for solution:

      http://getfundas746.blogspot.in/2012/12/orgapachecommonsnetftpftpconnectionclos.html

      Delete
  2. I haven't tried it on Linux before. Per the referenced bug report, I'd probably try to "Manually copy /lib/libsendfile.so.1 to the anonymous ftp lib directory"

    ReplyDelete