FTPing a file to Mainframe using Java, Apache Common Net
- by SKR
I'm am trying to upload a file into mainframe server using FTP. My code is below
FTPClient client = new FTPClient();
InputStream in = null;
FileInputStream fis = null;
try{
client.connect("10.10.23.23");
client.login("user1", "pass123");
client.setFileType(FTPClient.BINARY_FILE_TYPE);
int reply ;
reply = client.getReplyCode();
System.out.println("Reply Code:"+reply);
if(FTPReply.isPositiveCompletion(reply)){
System.out.println("Positive reply");
String filename ="D:\\FILE.txt";
in = new FileInputStream(filename);
client.storeFile("FILE.TXT", in);
client.logout();
fis.close();
}else{
System.out.println("Negative reply");
}
}catch(final Throwable t){
t.printStackTrace();
}
The code gets struck in client.storeFile("FILE.TXT", in);
I am unable to debug. Please suggest ways / solutions.