How to run a jar file from the mid server
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 11:47 AM
HI everybody,
I develop a java application and I want to run it from the mid server.
So I created a record in table "MID Server JAR Files" and upload the JAR file. I saw that the jar file was downloaded to the mid server to folder "extlib".
Then I created a workflow with activity type "JavaScript Probe" with this script:
var temp= new Packages.com.company.extractstring.Extractortext();
temp.main();
And I'm getting an error message "EvaluatorException (var temp= new Packages.com.company.extractstring.Extractortext(); temp.main();)
So my question is what is the correct way to run the java application in the mid server?
Some more data:
The jar file name is "extractstring"
The package name is: com.company.extractstring
The class is: Extractortext
The method is: public static void main
I tested the java app and it is working ok.
Thank you for your answers
Lior grinberg
- Labels:
-
Integrations
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 09:34 PM
Please check below video which tells you steps to consume JAR file
Leveraging Custom JAR files on a MID Server - YouTube
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 12:20 PM
HI Sachin,
I was able to make it work but not fully.
This is the java class I create for testing:
package com.mycompany.sample1;
public class helloworld {
public static String get(String name)
{
return "Hello "+name;
}
}
And this is the JavascriptProbe entry in the ECC:
<parameters>
<parameter name="script" value="var temp= new Packages.com.mycompany.sample1.helloworld(); temp.get('lior');" />
</parameters>
And this what I got in return:
<?xml version="1.0" encoding="UTF-8"?><results probe_time="28" result_code="0"><result><output>Hello lior</output></result><parameters><parameter name="agent" value="mid.server.mid_server"/><parameter name="response_to" value=""/><parameter name="from_sys_id" value=""/><parameter name="source" value=""/><parameter name="priority" value="2"/><parameter name="agent_correlator" value=""/><parameter name="script" value="var temp= new Packages.com.mycompany.sample1.helloworld(); temp.get('lior');"/><parameter name="processed" value="2019-01-19 20:54:08"/><parameter name="error_string" value=""/><parameter name="sys_id" value="c20114670f032300ffd34f8ce1050ef3"/><parameter name="sequence" value="168608384070000001"/><parameter name="from_host" value=""/><parameter name="sys_created_on" value="2019-01-22 19:57:39"/><parameter name="sys_domain" value="global"/><parameter name="name" value="test java 4"/><parameter name="topic" value="JavascriptProbe"/><parameter name="state" value="ready"/><parameter name="queue" value="output"/><parameter name="ecc_queue" value="c20114670f032300ffd34f8ce1050ef3"/></parameters></results>
So My question is why the state of the message is "error"?
And also how is the correct way to get the output in service via code?
And another question is how should I get the output of the jar if it returns lots of objects? Example the jar file retrieve incident details and also it's attachments of the incident. how should I receive all of this data from the ECC.
Thanks,
Lior Grinberg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2019 12:55 PM
HI,
Thanks for the link.
I'm getting an error message "Evaluation error: EvaluatorException...."
Can someone help?
Thanks,
Lior grinberg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2019 01:00 PM
HI Sachin,
I was able to make it work but not fully.
This is the java class I create for testing:
package com.mycompany.sample1;
public class helloworld {
public static String get(String name)
{
return "Hello "+name;
}
}
And this is the JavascriptProbe entry in the ECC:
<parameters>
<parameter name="script" value="var temp= new Packages.com.mycompany.sample1.helloworld(); temp.get('lior');" />
</parameters>
And this what I got in return:
<?xml version="1.0" encoding="UTF-8"?><results probe_time="28" result_code="0"><result><output>Hello lior</output></result><parameters><parameter name="agent" value="mid.server.mid_server"/><parameter name="response_to" value=""/><parameter name="from_sys_id" value=""/><parameter name="source" value=""/><parameter name="priority" value="2"/><parameter name="agent_correlator" value=""/><parameter name="script" value="var temp= new Packages.com.mycompany.sample1.helloworld(); temp.get('lior');"/><parameter name="processed" value="2019-01-19 20:54:08"/><parameter name="error_string" value=""/><parameter name="sys_id" value="c20114670f032300ffd34f8ce1050ef3"/><parameter name="sequence" value="168608384070000001"/><parameter name="from_host" value=""/><parameter name="sys_created_on" value="2019-01-22 19:57:39"/><parameter name="sys_domain" value="global"/><parameter name="name" value="test java 4"/><parameter name="topic" value="JavascriptProbe"/><parameter name="state" value="ready"/><parameter name="queue" value="output"/><parameter name="ecc_queue" value="c20114670f032300ffd34f8ce1050ef3"/></parameters></results>
So My question is why the state of the message is "error"?
And also how is the correct way to get the output in service via code?
Thanks,
Lior Grinberg