Announcement

Collapse
No announcement yet.

How to make channel to run jar files

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

  • #31
    Error calling java class

    Hi,

    I do my test using this post but...

    I have the same problem :
    "ERROR-300: Transformer error
    ERROR MESSAGE: Error evaluating transformer
    com.webreach.mirth.server.MirthJavascriptTransform erException:
    CHANNEL: RemoteNotification-RX
    CONNECTOR: Testing
    SCRIPT SOURCE:
    SOURCE CODE:
    9:
    10: var idrecord = msg['cud_objets_id'].toString();
    11: var numobj = msg['cud_objets_numobj'].toString();
    12: var cud = msg['cud_objets_cud'].toString();
    13: var trt = msg['cud_objets_fgtrt'].toString();
    14: var MyCls = new Packages.testmirthws.Main();
    15: MyCls.DoTest(idrecord,numobj);
    16: var t = MyCls.getT();
    17:
    18: }
    LINE NUMBER: 14
    DETAILS: TypeError: [JavaPackage testmirthws.Main] is not a function, it is object. ..."

    Here is the java code, create with Netbeans IDE 6.5.1 :
    "
    package testmirthws;

    public class Main {

    private static TestingWS t = new TestingWS();

    public static void main(String[] args) {
    System.out.println("HELLO");
    }

    public static TestingWS getT() {
    return t;
    }

    public static void setT(TestingWS aT) {
    t = aT;
    }

    public void DoTest(String a, String b) {
    System.out.println("Welcome to 'DoTest'");
    t.setCode(a);
    t.setCodeType(b);
    }

    }
    "

    Someone can help me ?

    Thanx a lot

    Comment


    • #32
      1. call your class something other than main
      2. this is wrong: new Packages.testmirthws.Main();
      3. if you keep your class named as Main the code looks like:

      var object = new Packages.Main();

      Comment


      • #33
        new test - same problem

        java code :

        package sli.test;

        public class MirthTest {

        public MirthTest() {
        System.out.println("here is the constructor");
        }

        public String DoIt() {
        System.out.println("Welcome to MirthTest");
        return "WELCOME";
        }
        }

        mirth transformer :

        var object = new Packages.MirthTest();
        tmp['row']['column1'] = numobj;
        tmp['row']['column2'] = idrecord;
        tmp['row']['column3'] = object.DoIt();

        I got the same error (TypeError: [JavaPackage MirthTest] is not a function, it is object.)

        if I use :
        var object = new Packages.sli.test.MirthTest();

        Same problem.

        Where is the problem ? I do not understand the logic of mirth.
        Thanks you for help

        Comment

        Working...
        X