Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
9.8k views
in Java FTP by (320 points)
This happens about 1/2 of the time, the previous ftpClient command seem to work correctly, other than the error it seems to be fine.
I do not get any errors on login, connect or put.
I do check the ftpClient.connected() b4 I do the ftpClient.quit().

edpftpj-pro-1.2.9 jar file is being used. I will test the 1.3.0 when it comes out.

Thanks, Les

16:04:11,822 ERROR [FTPWriter] IOExcepion=Connection reset
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:408)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:450)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at com.enterprisedt.net.ftp.FTPControlSocket.D(Unknown Source)
at com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(Unknown Source)

at com.enterprisedt.net.ftp.FTPClient.quit(Unknown Source)
at com.infor.xq.service.ftp.FTPWriter.disconnect(FTPWriter.java:321)
at com.infor.xq.service.ftp.FTPWriterService.ccService(FTPWriterService.
java:180)
at com.infor.xq.service.CCService.service(CCService.java:345)
at com.sonicsw.xqimpl.service.ServiceMessageHandler.nK_(:328)
at com.sonicsw.xqimpl.service.ServiceMessageHandler.handleMessage(:124)
at com.sonicsw.xqimpl.service.XQDispatcher.onMessage(:229)
at com.sonicsw.xqimpl.endpoint.container.EndpointContextContainer.onMess
age(:47)
at com.sonicsw.xq.connector.jms.y.onMessage(:450)
at progress.message.jimpl.Session.dU_(:2907)
at progress.message.jimpl.Session.run(:2311)
at progress.message.jimpl.dm.run(:2706)

10 Answers

0 votes
by (162k points)
It looks like quit() has been called when the server has already closed the connection. Is this a possibility? You can't maintain an idle connection with FTP - the server will kick you off.
0 votes
by (320 points)
Well I am just testing sending a small file, the program does the connect, login, put, quit all in sequence. I am setting a timeout of 120000 milli seconds. I am not letting the conenction sit there open at all. The original ftp.jar file we have before doesn't seem to throw this error so makes me wonder. There is an error logged for the SSHFTPClient doing this but didnt' see anything about the FTPClient.

Thanks, :)
0 votes
by (162k points)
If you could post a log file that will help a lot - we'll take a look.
0 votes
by (320 points)
I am working with our IT dept to figure out how/where to turn on or find ftp logs on the server side (unix aix box). My apoligies I have not done much with ftp except use it until now.

Thx,
0 votes
by (162k points)
Actually I meant the edtFTPj client logs.

import com.enterprisedt.util.debug.Level;
import com.enterprisedt.util.debug.Logger;

Logger.setLevel(Level.DEBUG);
0 votes
by (320 points)
I included one that failed and one that did not. I can trap the error and ignor it but wanted to make sure I wasn't doing anything wrong.
Both of these examples us the same settings, I just keep clicking send until I get one to fail.

I have tried another ftp site, same results. Was not having this issue with our old ftp.jar(from somewhere else).

Thanks for the debug tip, did this replace the ftpClient.debugResponses ?

Here's one that did fail.

to us-cos-dv03/10.110.3.30:21
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.386 : 220
(vsFTPd 2.0.1)
15:49:00,386 DEBUG [FTPWriter] timeout = 120000
15:49:00,386 DEBUG [FTPWriter] Connection to ftp server established
15:49:00,386 DEBUG [FTPWriter] <-- connectToFTPServer()
15:49:00,386 DEBUG [FTPWriter] --> login()
15:49:00,386 DEBUG [FTPWriter] user=lbrooks, password=****
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.386 : ---
> USER lbrooks
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.396 : 331
Please specify the password.
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.396 : ---
> PASS ********
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.425 : 230
Login successful.
15:49:00,425 DEBUG [FTPWriter] Logged into FTP server
15:49:00,425 DEBUG [FTPWriter] <-- login()
15:49:00,425 DEBUG [FTPWriter] --> setFTPClientOptions()
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.425 : ---
> CWD /dv/tmp/les
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.445 : 250
Directory successfully changed.
15:49:00,445 DEBUG [FTPWriter] Changed ftpWriter.getDirectory()
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.445 : ---
> TYPE A
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.445 : 200
Switching to ASCII mode.
15:49:00,455 DEBUG [FTPWriter] <-- setFTPClientOptions()
15:49:00,455 DEBUG [FTPWriter] --> sendFile()
15:49:00,455 DEBUG [FTPWriter] SendFile, attempt number: 2
15:49:00,455 DEBUG [FTPWriter] append data=true
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.465 : ---
> PORT 10,110,1,57,17,107
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.475 : 200
PORT command successful. Consider using PASV.
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.475 : ---
> APPE les_200611915490238.dat
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.475 : 150
Ok to send data.
DEBUG [com.enterprisedt.net.ftp.FTPClient] 11 Oct 2006 15:49:00.475 : Transferre
d 12 bytes to remote host
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.475 : 226
File receive OK.
15:49:00,475 DEBUG [FTPWriter] SendFile has put the file to the ftp server.
15:49:00,475 DEBUG [FTPWriter] <-- sendFile()
15:49:00,485 DEBUG [FTPWriter] --> disconnect()
15:49:00,485 DEBUG [FTPWriter] ftp disconnecting
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:49:00.485 : ---
> QUIT
15:49:00,485 ERROR [FTPWriter] IOExcepion=Connection reset
15:49:00,495 ERROR [FTPWriter] ----------------------ftp status =false
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:408)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:450)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at com.enterprisedt.net.ftp.FTPControlSocket.D(Unknown Source)
at com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(Unknown Source)

at com.enterprisedt.net.ftp.FTPClient.quit(Unknown Source)
at com.infor.xq.service.ftp.FTPWriter.disconnect(FTPWriter.java:347)
at com.infor.xq.service.ftp.FTPWriter.writeFile(FTPWriter.java:67)
at com.infor.xq.service.ftp.FTPWriterService.ccService(FTPWriterService.
java:169)
at com.infor.xq.service.CCService.service(CCService.java:345)
at com.sonicsw.xqimpl.service.ServiceMessageHandler.nK_(:328)
at com.sonicsw.xqimpl.service.ServiceMessageHandler.handleMessage(:124)
at com.sonicsw.xqimpl.service.XQDispatcher.onMessage(:229)
at com.sonicsw.xqimpl.endpoint.container.EndpointContextContainer.onMess
age(:47)
at com.sonicsw.xq.connector.jms.y.onMessage(:450)
at progress.message.jimpl.Session.dU_(:2907)
at progress.message.jimpl.Session.run(:2311)
at progress.message.jimpl.dm.run(:2706)

Here's one that did not fail.

DEBUG [com.enterprisedt.net.ftp.FTPClient] 11 Oct 2006 15:51:43.980 : Connecting
to us-cos-dv03/10.110.3.30:21
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:43.990 : 220
(vsFTPd 2.0.1)
15:51:43,990 DEBUG [FTPWriter] timeout = 120000
15:51:43,990 DEBUG [FTPWriter] Connection to ftp server established
15:51:43,990 DEBUG [FTPWriter] <-- connectToFTPServer()
15:51:44,000 DEBUG [FTPWriter] --> login()
15:51:44,000 DEBUG [FTPWriter] user=lbrooks, password=****
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:44.0 : --->
USER lbrooks
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:44.10 : 331
Please specify the password.
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:44.10 : --->
PASS ********
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:44.50 : 230
Login successful.
15:51:44,050 DEBUG [FTPWriter] Logged into FTP server
15:51:44,050 DEBUG [FTPWriter] <-- login()
15:51:44,050 DEBUG [FTPWriter] --> setFTPClientOptions()
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:44.50 : --->
CWD /dv/tmp/les
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:44.50 : 250
Directory successfully changed.
15:51:44,050 DEBUG [FTPWriter] Changed ftpWriter.getDirectory()
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:44.60 : --->
TYPE A
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:44.60 : 200
Switching to ASCII mode.
15:51:44,060 DEBUG [FTPWriter] <-- setFTPClientOptions()
15:51:44,060 DEBUG [FTPWriter] --> sendFile()
15:51:44,070 DEBUG [FTPWriter] SendFile, attempt number: 2
15:51:44,070 DEBUG [FTPWriter] append data=true
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:44.70 : --->
PORT 10,110,1,57,17,156
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:44.80 : 200
PORT command successful. Consider using PASV.
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:44.80 : --->
APPE les_2006119155143960.dat
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 11 Oct 2006 15:51:44.80 : 150
Ok to send data.
DEBUG [com.enterprisedt.net.ftp.FTPClient] 11 Oct 2006 15:51:44.80 : Transferred
12 bytes
0 votes
by (162k points)
It looks like the server is abruptly closing the connection as soon as it receives the quit. This is non-standard but not that uncommon either.

Try using

ftp.setConfigFlags(SSLFTPClient.ConfigFlags.DISABLE_SSL_CLOSURE);
0 votes
by (320 points)
This program uses a standard ftp, not ssl. I am using the FTPClient for this one and it doesn't have the setConfigFlags on it. I am using the SSLFTPClient for the program that uses ssl and it's not having this issue.

Am I using the correct classes for what I am doing?

Thanks so much,
0 votes
by (320 points)
Another tidbit, I am working from home today, getting to the server via vpn and I do not get that error.
This connection would be slower, hmmm. I'll catch and log the error for now and try the new jar when it comes out. I'll have to try to get this out to a customer or 2 also test outl.

thx,
0 votes
by (162k points)
You are using the correct classes, and FTPClient doesn't have setConfigFlags.

It could be that this FTP just closes the connection abruptly, although this is uncommon. Using a command line FTP (type 'debug' to switch on debugging) do you see anything unusual?

Categories

...