JSCH exception Custom SFTP Error
We are trying to build a custom sftp to get a file from a remote machine and we are using pega 7.3.1 version (in Cloud) .But getting error
com.jcraft.jsch.JSchException: UnknownHostKey: xx.xx.xx.xx. RSA key fingerprint is Proprietary information hidden: Proprietary information hidden
below is the code snippet using JSCH
java.io.InputStream inputStream = null;
com.jcraft.jsch.ChannelSftp sftpChannel=null;
com.jcraft.jsch.Session ftpSession=null;
boolean isSuccess=false;
try {
com.jcraft.jsch.JSch jsch = new com.jcraft.jsch.JSch();
ftpSession = jsch.getSession(UserName,HostName,Port);
ftpSession.setPassword(Password);
ftpSession.connect();
oLog.error("Session connected ");
sftpChannel = (com.jcraft.jsch.ChannelSftp) ftpSession.openChannel("sftp");
sftpChannel.connect();
sftpChannel.put(new java.io.ByteArrayInputStream(LocalFile.getBytes()),remotePath,com.jcraft.jsch.ChannelSftp.OVERWRITE );
isSuccess=true;
}
catch (java.lang.Exception e) {
oLog.error(e.toString());
}
finally{
if (sftpChannel != null && sftpChannel.isConnected()) {
sftpChannel.disconnect();
}
if (ftpSession != null && ftpSession.isConnected()) {
ftpSession.disconnect();
}
}
return isSuccess;
***Edited by Moderator Marissa to update platform capability tags****