java - I am trying to post multiple file using SFTP connection but not able to post more than 2 files -



java - I am trying to post multiple file using SFTP connection but not able to post more than 2 files -

i trying post multiple file using sftp connection. using below code connect sftp server , post file on server.

my programme running 2 file not more that, 3rd file on words generates authentication error "com.jcraft.jsch.jschexception: auth fail".

could please guide me that.

public boolean putsftp(string input , string filename) { jsch jsch = new jsch(); session session = null; seek { system.out.println("input : "+input+": file name :"+filename+" :-----------logon on server---------- : "+ datetime); session = jsch.getsession(user_name, ftp_hostname, 22); session.setconfig("stricthostkeychecking", "no"); session.setpassword(password); session.connect(); channel channel = session.openchannel("sftp"); channel.connect(); channelsftp sftpchannel = (channelsftp) channel; sftpchannel.cd(to_directory); sftpchannel.put(input+filename, filename); system.out.println("file sucessfully posted on server....:"+datetime); sftpchannel.exit(); session.disconnect(); result = true; }catch (jschexception e) { system.out.println("here jsch...!!! : "); e.printstacktrace(); }catch (sftpexception e) { system.out.println("here sftp...!!! :"); e.printstacktrace(); } grab (exception e){ system.out.println("here exception...!!!"+e); }finally { system.out.println("in side of sftp method....."+result); } homecoming result; }

java sftp jsch

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -