Groovy error when connecting to SFTP server
We encountered Groovy error when connecting to SFTP server.
The error says "InvokerInvocationException com.jcraft.jsch.JSchException: Algorithm negotiation fail"
Can someone shed lights on the solution?
How to reproduce: We created a Custom Request, and added some Groovy coding.
Example:
import com.jcraft.jsch.*
//
java.util.Properties config = new java.util.Properties()
config.put("StrictHostKeyChecking", "no")
JSch ssh = new JSch()
Session sess = ssh.getSession(strUserName, strHostName, iPort)
sess.setConfig(config)
sess.with{
setPassword strPassword
connect()
Channel chan = openChannel "sftp"
chan.connect()
ChannelSftp sftp = (ChannelSftp) chan;
sftp.cd(strSourceFilePath)
sftp.put(strNewFilePathName, strSourceFileName)
chan.disconnect()
disconnect()
}