web stats
How to make channel to run jar files - Page 4 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #31  
Old 09-08-2010, 06:14 AM
benyssen benyssen is offline
OBX.1 Kenobi
 
Join Date: Sep 2010
Posts: 38
benyssen is on a distinguished road
Unhappy 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
Reply With Quote
  #32  
Old 09-08-2010, 11:48 AM
bradd bradd is offline
Mirth Employee
 
Join Date: May 2009
Location: Irvine, CA
Posts: 133
bradd is on a distinguished road
Default

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();
Reply With Quote
  #33  
Old 09-09-2010, 12:31 AM
benyssen benyssen is offline
OBX.1 Kenobi
 
Join Date: Sep 2010
Posts: 38
benyssen is on a distinguished road
Default 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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 10:13 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation