I am transferring secure files to remote server using JSCH api. I am
using jsch-0.1.51.jar
And i am getting below error (marked red ) .
Some of the files securely get transferred and then script breaks in
between and this error is thrown.
My code is attached in email. Can someone tell me what i am missing ?
appreciate
some help. Thanks !
Regard's
G_Singh
java.io.IOException: channel is broken
at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:688)
at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:475)
at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:365)
at org.apache.jsp.jsp.test_jsp._jspService(test_jsp.java:656)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:856)
at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: channel is broken
at com.jcraft.jsch.Session.write(Session.java:1268)
at com.jcraft.jsch.ChannelSftp.sendWRITE(ChannelSftp.java:2619)
at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:668)
JSch jsch = new JSch();
Session jschSession = null;
ResourceBundle
bundle=ResourceBundle.getBundle("salesPortalProperties");
String SFTPHOST = bundle.getString("SFTPHOST");
int SFTPPORT = Integer.parseInt(bundle.getString("SFTPPORT"));
String SFTPPASS = bundle.getString("SFTPPASS");
String SFTPUSER = bundle.getString("SFTPUSER");
String SFTPWORKINGDIR = bundle.getString("SFTPWORKINGDIR");
try {
jschSession = jsch.getSession(SFTPUSER,SFTPHOST,SFTPPORT);
jschSession.setConfig("StrictHostKeyChecking", "no");
jschSession.setPassword(SFTPPASS);
jschSession.connect();
Channel channel = jschSession.openChannel("sftp");
channel.connect();
// System.out.println("Secure SAVO SFTP channel connected
----"+channel.isConnected());
ChannelSftp sftpChannel = (ChannelSftp) channel;
sftpChannel.cd(SFTPWORKINGDIR);
String currentDirectory=sftpChannel.pwd();
for(Map.Entry<String,String> entry :
mapoffilesPath.entrySet()){
staticNumber++;
sftpChannel.put(entry.getKey(),entry.getValue()); // for loop
for all the static files here....
System.out.println("file number"+staticNumber);
}
sftpChannel.exit();
jschSession.disconnect();
} catch (JSchException e) {
e.printStackTrace();
} catch (SftpException e) {
e.printStackTrace();
} ------------------------------------------------------------------------------
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users