You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Sathish G <sa...@rediffmail.com> on 2009/12/23 06:58:28 UTC

Connection Reset Error with Commons FTP

Hi all,

I'm using Commons FTP to upload file. The API works fine but for some reason
i get the following error occasionally. I have added the error trace and the
code that i use to send the file using FTP.

What Puzzles me is that the FTP API throws Error but the file is still
copied correctly to the Host.

Can i just ignore this error or is it that something is wrong.

try{
          FtpClient ftpClient = .....
          ftpClient.enterLocalPassiveMode();
          ftpClient.storeFile(directoryName + fileName, stream);
}catch(Exception ...){
        ..............
} finally {
            disconnect ftp....
}


Stack trace .........

Caused by: java.net.SocketException: Connection reset
                at
java.net.SocketInputStream.read(SocketInputStream.java:195)
                at
java.io.BufferedInputStream.read1(BufferedInputStream.java(Compiled Code))
                at
java.io.BufferedInputStream.read(BufferedInputStream.java(Compiled Code))
                at
java.io.BufferedInputStream.fill(BufferedInputStream.java:200)
                at
java.io.BufferedInputStream.read(BufferedInputStream.java(Compiled Code))
                at
org.apache.commons.net.telnet.TelnetInputStream.__read(TelnetInputStream.java:114)
                at
org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream.java:535)
                at java.lang.Thread.run(Thread.java:568)

-- 
View this message in context: http://n4.nabble.com/Connection-Reset-Error-with-Commons-FTP-tp977598p977598.html
Sent from the Commons - User mailing list archive at Nabble.com.

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


Re: Connection Reset Error with Commons FTP

Posted by Steve Cole <sc...@camsbycbs.com>.
The api documentation for the FTP class provides some advice for handling
connections that are prematurely closed. I'd also verify the version of
Commons Net because the TelnetClient is not used in the current 1.4.1
version of the FTP class. A version of FTP that extends SocketClient instead
of TelnetClient may handle connections better.

----- Original Message ----- 
From: "Sathish G" <sa...@rediffmail.com>
To: <us...@commons.apache.org>
Sent: Saturday, December 26, 2009 7:36 AM
Subject: Re: Connection Reset Error with Commons FTP


>
> Hi,
>
> I'm using Commons Net 1.4.1. and JDK 1.4.
>
>
>
> Steve Cole-6 wrote:
> >
> > What version of Commons Net are you using? Looks like an older one. Try
a
> > newer version, either 1.4.1 or 2.0.
> >
> > ----- Original Message ----- 
> > From: "Sathish G" <sa...@rediffmail.com>
> > To: <us...@commons.apache.org>
> > Sent: Wednesday, December 23, 2009 12:58 AM
> > Subject: Connection Reset Error with Commons FTP
> >
> >
> >>
> >> Hi all,
> >>
> >> I'm using Commons FTP to upload file. The API works fine but for some
> > reason
> >> i get the following error occasionally. I have added the error trace
and
> > the
> >> code that i use to send the file using FTP.
> >>
> >> What Puzzles me is that the FTP API throws Error but the file is still
> >> copied correctly to the Host.
> >>
> >> Can i just ignore this error or is it that something is wrong.
> >>
> >> try{
> >>           FtpClient ftpClient = .....
> >>           ftpClient.enterLocalPassiveMode();
> >>           ftpClient.storeFile(directoryName + fileName, stream);
> >> }catch(Exception ...){
> >>         ..............
> >> } finally {
> >>             disconnect ftp....
> >> }
> >>
> >>
> >> Stack trace .........
> >>
> >> Caused by: java.net.SocketException: Connection reset
> >>                 at
> >> java.net.SocketInputStream.read(SocketInputStream.java:195)
> >>                 at
> >> java.io.BufferedInputStream.read1(BufferedInputStream.java(Compiled
> >> Code))
> >>                 at
> >> java.io.BufferedInputStream.read(BufferedInputStream.java(Compiled
Code))
> >>                 at
> >> java.io.BufferedInputStream.fill(BufferedInputStream.java:200)
> >>                 at
> >> java.io.BufferedInputStream.read(BufferedInputStream.java(Compiled
Code))
> >>                 at
> >>
> >
org.apache.commons.net.telnet.TelnetInputStream.__read(TelnetInputStream.jav
> > a:114)
> >>                 at
> >>
> >
org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream.java:5
> > 35)
> >>                 at java.lang.Thread.run(Thread.java:568)
> >>
> >> -- 
> >> View this message in context:
> >
http://n4.nabble.com/Connection-Reset-Error-with-Commons-FTP-tp977598p977598.html
> >> Sent from the Commons - User mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
> >
>
> -- 
> View this message in context:
http://n4.nabble.com/Connection-Reset-Error-with-Commons-FTP-tp977598p979059.html
> Sent from the Commons - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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


Re: Connection Reset Error with Commons FTP

Posted by Sathish G <sa...@rediffmail.com>.
Hi,

I'm using Commons Net 1.4.1. and JDK 1.4.



Steve Cole-6 wrote:
> 
> What version of Commons Net are you using? Looks like an older one. Try a
> newer version, either 1.4.1 or 2.0.
> 
> ----- Original Message ----- 
> From: "Sathish G" <sa...@rediffmail.com>
> To: <us...@commons.apache.org>
> Sent: Wednesday, December 23, 2009 12:58 AM
> Subject: Connection Reset Error with Commons FTP
> 
> 
>>
>> Hi all,
>>
>> I'm using Commons FTP to upload file. The API works fine but for some
> reason
>> i get the following error occasionally. I have added the error trace and
> the
>> code that i use to send the file using FTP.
>>
>> What Puzzles me is that the FTP API throws Error but the file is still
>> copied correctly to the Host.
>>
>> Can i just ignore this error or is it that something is wrong.
>>
>> try{
>>           FtpClient ftpClient = .....
>>           ftpClient.enterLocalPassiveMode();
>>           ftpClient.storeFile(directoryName + fileName, stream);
>> }catch(Exception ...){
>>         ..............
>> } finally {
>>             disconnect ftp....
>> }
>>
>>
>> Stack trace .........
>>
>> Caused by: java.net.SocketException: Connection reset
>>                 at
>> java.net.SocketInputStream.read(SocketInputStream.java:195)
>>                 at
>> java.io.BufferedInputStream.read1(BufferedInputStream.java(Compiled
>> Code))
>>                 at
>> java.io.BufferedInputStream.read(BufferedInputStream.java(Compiled Code))
>>                 at
>> java.io.BufferedInputStream.fill(BufferedInputStream.java:200)
>>                 at
>> java.io.BufferedInputStream.read(BufferedInputStream.java(Compiled Code))
>>                 at
>>
> org.apache.commons.net.telnet.TelnetInputStream.__read(TelnetInputStream.jav
> a:114)
>>                 at
>>
> org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream.java:5
> 35)
>>                 at java.lang.Thread.run(Thread.java:568)
>>
>> -- 
>> View this message in context:
> http://n4.nabble.com/Connection-Reset-Error-with-Commons-FTP-tp977598p977598.html
>> Sent from the Commons - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: http://n4.nabble.com/Connection-Reset-Error-with-Commons-FTP-tp977598p979059.html
Sent from the Commons - User mailing list archive at Nabble.com.

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


Re: Connection Reset Error with Commons FTP

Posted by Steve Cole <sc...@camsbycbs.com>.
What version of Commons Net are you using? Looks like an older one. Try a
newer version, either 1.4.1 or 2.0.

----- Original Message ----- 
From: "Sathish G" <sa...@rediffmail.com>
To: <us...@commons.apache.org>
Sent: Wednesday, December 23, 2009 12:58 AM
Subject: Connection Reset Error with Commons FTP


>
> Hi all,
>
> I'm using Commons FTP to upload file. The API works fine but for some
reason
> i get the following error occasionally. I have added the error trace and
the
> code that i use to send the file using FTP.
>
> What Puzzles me is that the FTP API throws Error but the file is still
> copied correctly to the Host.
>
> Can i just ignore this error or is it that something is wrong.
>
> try{
>           FtpClient ftpClient = .....
>           ftpClient.enterLocalPassiveMode();
>           ftpClient.storeFile(directoryName + fileName, stream);
> }catch(Exception ...){
>         ..............
> } finally {
>             disconnect ftp....
> }
>
>
> Stack trace .........
>
> Caused by: java.net.SocketException: Connection reset
>                 at
> java.net.SocketInputStream.read(SocketInputStream.java:195)
>                 at
> java.io.BufferedInputStream.read1(BufferedInputStream.java(Compiled Code))
>                 at
> java.io.BufferedInputStream.read(BufferedInputStream.java(Compiled Code))
>                 at
> java.io.BufferedInputStream.fill(BufferedInputStream.java:200)
>                 at
> java.io.BufferedInputStream.read(BufferedInputStream.java(Compiled Code))
>                 at
>
org.apache.commons.net.telnet.TelnetInputStream.__read(TelnetInputStream.jav
a:114)
>                 at
>
org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream.java:5
35)
>                 at java.lang.Thread.run(Thread.java:568)
>
> -- 
> View this message in context:
http://n4.nabble.com/Connection-Reset-Error-with-Commons-FTP-tp977598p977598.html
> Sent from the Commons - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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