Announcement

Collapse
No announcement yet.

sftp connection issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • sftp connection issue

    I am having an issue connecting to a sftp server as a file writer destination.
    If I use winscp then I can connect successfully if I change the preferred sftp protocol version to 3, from the default value of 5.
    Using mirth I get an algorithm error and it fails to connect.
    is there a way to change the sftp protocol version in mirth or has anyone resolved this issue?

    I am using mirth connect v2.X

  • #2
    You may want to try a Javascript writer using JSCH.
    Take a look at:
    http://epaul.github.io/jsch-document...annelSftp.html

    Here is a snip of code from my Mirth JS writer to use JSCH:


    importPackage(com.jcraft.jsch);
    importPackage(java.io);
    importPackage(java.lang);

    var retry = 0;
    var errorCond = 'false';

    var f1 = new File($('OUTBOX') + '/' + $('SINGLE_FILE_NAME'));
    var port = $('DEST_PORT');
    if(port == '' || port == null)
    port = 22;

    do {

    try {

    var jsch = new JSch();

    jsch.setConfig('StrictHostKeyChecking','no');
    var session = jsch.getSession($('USER'),$('DEST_IP'),port);
    session.setPassword($('PASS'));
    session.setTimeout(30000)
    session.connect();
    var channel = session.openChannel('sftp');
    channel.connect();

    channel.cd($('DEST_FOLDER'));
    channel.put(new FileInputStream(f1), $('SINGLE_FILE_NAME'));

    session.disconnect();
    errorCond = 'false';
    break;
    }
    catch(err) {
    logger.info('IN JSCH SFTP ERR : ' + err);
    //throw(err);
    retry++;
    if(retry > 10) {
    throw(err);
    break;
    }
    sleep(6);
    logger.info('HUB--> in SFTP Sender , retrying...' + retry.toString());
    errorCond = 'true';
    }
    }
    while (errorCond == 'true');

    Comment


    • #3
      SFTP Algorithm issue

      Hi, thanks for the reply, but I am looking for an answer as to whether Mirth Connect has limitations with SFTP.


      Has anyone else had issues with SFTP connections?

      Comment

      Working...
      X