I'm having a sporadic issue transferring files to a Mainframe, was wondering if anyone else has run into this. I'm trying to figure out if this is a Mainframe issue, or a net commons issue.
I'm using Java 1.7 and commons-net-3.3.jar The file transfer completes, but it looks like either the 200 OK is sent over the wrong connection, or is not properly being parsed and is causing the cleanup to fail. According to the reply: IBM FTP CS V2R2 is the version where the issue occurs. I have a second mainframe that is running IBM FTP CS V1R13 that doesn't seem to have this issue In a normal transfer, you would see: 250 Transfer completed successfully. File Transfer Completed Successfully at: 2016-11-17 04:30:51.569 QUIT 221 Quit command received. Goodbye. This is what we are getting on the failures: 250 Transfer completed successfully. 200 OK File Transfer Failed at: 2016-11-17 04:36:50.246 Error Occurred Transmitting File to Remote System, aborting... Read timed out Here's the full log from the failed transfer: Using FTPS Connection with Protocol: TLS and Explicit Security Request 220-FTPSECR1 IBM FTP CS V2R2 at MVSP.XXX, 09:27:29 on 2016-11-17. 220 Connection will close if idle for more than 5 minutes. AUTH TLS 234 Security environment established - ready for negotiation Connected to mvsp.xxx on xxxx PBSZ 0 200 Protection buffer size accepted PROT P 200 Data connection protection set to private USER ******* 331 Send password please. PASS ******* 230 C836PTS is logged on. Working directory is "C836PTS.". PWD 257 "'C836PTS.'" is working directory. Using a Packet Size of: 4096 Control KeepAliveTimeOut: 60 Control KeepAliveReplyTimeOut: 5000 FEAT 211- Extensions supported AUTH TLS PBSZ PROT 211 End ...FTPClientUtil Connected Successfully! SITE TRAIL 200 SITE command was accepted SITE CYLINDERS PRIMARY=2100 SECONDARY=250 200 SITE command was accepted SITE RECFM=FB LRECL=1915 BLKSIZE=30640 200 SITE command was accepted SITE CONDDISP=delete 200 SITE command was accepted Sending: Local: d:\LargeExtracts\full.txt Remote: 'A836.ORG.CAMA2.FULL' Starting at: 2016-11-17 09:27:34.798 Total Bytes To Send: 2101359588 PASV 227 Entering Passive Mode (xx,xx,x,xx,xx,xx) STOR 'A836.ORG.CAMA2.FULL' 125 Storing data set A836.ORG.CAMA2.FULL 2016-11-17 09:27:47.721 - 5 Percent Complete, Total Bytes Transferred: 105070592 2016-11-17 09:28:01.190 - 10 Percent Complete, Total Bytes Transferred: 210137088 ... 2016-11-17 09:32:21.127 - 100 Percent Complete, Total Bytes Transferred: 2101359588 250 Transfer completed successfully. 200 OK File Transfer Failed at: 2016-11-17 09:32:26.127 Error Occurred Transmitting File to Remote System, aborting... Read timed out java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at sun.security.ssl.InputRecord.readFully(Unknown Source) at sun.security.ssl.InputRecord.read(Unknown Source) at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.readDataRecord(Unknown Source) at sun.security.ssl.AppInputStream.read(Unknown Source) at sun.nio.cs.StreamDecoder.readBytes(Unknown Source) at sun.nio.cs.StreamDecoder.implRead(Unknown Source) at sun.nio.cs.StreamDecoder.read(Unknown Source) at java.io.InputStreamReader.read(Unknown Source) at java.io.BufferedReader.fill(Unknown Source) at java.io.BufferedReader.readLine(Unknown Source) at java.io.BufferedReader.readLine(Unknown Source) at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:314) at org.apache.commons.net.ftp.FTP.__getReplyNoReport(FTP.java:304) at org.apache.commons.net.ftp.FTPClient$CSL.cleanUp(FTPClient.java:3697) at org.apache.commons.net.ftp.FTPClient._storeFile(FTPClient.java:669) at org.apache.commons.net.ftp.FTPClient.__storeFile(FTPClient.java:624) at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:1976) at gov.nyc.ftputils.FTPConnection.sendFile(FTPConnection.java:695) at gov.nyc.ftputils.FTPPropertyProcessor.putFile(FTPPropertyProcessor.java:54) at gov.nyc.ftputils.FTPPropertyProcessor.putFile(FTPPropertyProcessor.java:96) at gov.nyc.ftputils.FTPPropertyProcessor.processFileProps(FTPPropertyProcessor.java:126) at gov.nyc.ftputils.FTPClientUtil.main(FTPClientUtil.java:378) FTPClientUtil has Failed QUIT 221 Quit command received. Goodbye. Here's a code snippet of the transfer code: try{ if (trace){ System.out.println("Total Bytes To Send: " + localFile.length()); CopyStreamListener listener = new ProgressStreamListener(localFile.length()); ftp.setCopyStreamListener(listener); } InputStream input = new FileInputStream(localFileName); boolean result = ftp.storeFile(tempRemoteFileName, input); input.close(); if (result){ System.out.println("\tFile Transfer Completed Successfully at: " + sdf.format(Calendar.getInstance().getTime())); ... } else System.out.println("\tFile Transfer Failed at: " + sdf.format(Calendar.getInstance().getTime())); return result; }catch (CopyStreamException cse){ System.err.println("\n\tFile Transfer Failed at: " + sdf.format(Calendar.getInstance().getTime()) + ", Failure occurred after " + cse.getTotalBytesTransferred() + " Bytes Transferred"); System.err.println("Error Occurred Transmitting File to Remote System, aborting...\n"); cse.printStackTrace(System.err); System.err.println("\n\nIOException Stack Trace that Caused the Error:\n"); cse.getIOException().printStackTrace(System.err); return false; }catch (IOException ioe){ System.err.println("\n\tFile Transfer Failed at: " + sdf.format(Calendar.getInstance().getTime())); System.err.println("Error Occurred Transmitting File to Remote System, aborting...\n"); System.err.println(ioe.getMessage()); ioe.printStackTrace(System.err); return false; }catch (Exception e){ System.err.println("\n\tFile Transfer Failed at: " + sdf.format(Calendar.getInstance().getTime())); System.err.println("Error Occurred Transmitting File to Remote System, aborting...\n"); e.printStackTrace(System.err); return false; } } Thanks, Mike...