Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Mid Server JAR

CY2
Tera Contributor

Hi, how can i execute a JAR file that is located in the MID server? 

Below is the code that i ran with Background Script:

var jspr = new JavascriptProbe('testmidserver');


jspr.setName('testMIDServer');


jspr.setJavascript("var doSomething = new Packages.com.javaapplication7.monkey();ms.log('Hello World'); doSomething.king()");


jspr.create();

 

ECC queve return me with the below error message:

 

<?xml version="1.0" encoding="UTF-8"?><results error="Caused by error in JavaScript probe 'testMIDServer' at line 1&#10;&#10;==&gt; 1: var doSomething = new Packages.com.javaapplication7.monkey();ms.log('Hello World'); doSomething.king()&#10;" probe_time="24" result_code="900000"><result error="Caused by error in JavaScript probe 'testMIDServer' at line 1&#10;&#10;==&gt; 1: var doSomething = new Packages.com.javaapplication7.monkey();ms.log('Hello World'); doSomething.king()&#10;"><output>Evaluation error: Caused by error in JavaScript probe 'testMIDServer' at line 1

==&gt; 1: var doSomething = new Packages.com.javaapplication7.monkey();ms.log('Hello World'); doSomething.king()</output></result><parameters><parameter name="agent" value="mid.server.testmidserver"/><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 doSomething = new Packages.com.javaapplication6;ms.log('Hello World'); doSomething()"/><parameter name="processed" value=""/><parameter name="error_string" value=""/><parameter name="sys_id" value="db5cb2f9db90230096e8a0f2ca961943"/><parameter name="sequence" value="1659dd11afe0000001"/><parameter name="from_host" value=""/><parameter name="sys_created_on" value="2018-09-03 05:04:11"/><parameter name="sys_domain" value="global"/><parameter name="name" value="testMIDServer"/><parameter name="topic" value="JavascriptProbe"/><parameter name="state" value="ready"/><parameter name="queue" value="output"/><parameter name="ecc_queue" value="db5cb2f9db90230096e8a0f2ca961943"/></parameters></results>

 

 

Please help me T_T

1 ACCEPTED SOLUTION

15 REPLIES 15

CY2
Tera Contributor

Yes,

 

find_real_file.png

And my run below code in script background:

 

var jp = new JavascriptProbe("testmidserver");
jp.setName("Anything");
jp.setJavascript("var req = new midServerScriptInclude(); req.javaFunctionCalls()");
jp.create();

CY2
Tera Contributor

I have followed as above.

 

<?xml version="1.0" encoding="UTF-8"?><results error="Caused by error in JavaScript probe 'Anything' at line 1&#10;&#10;==&gt; 1: var req = new midServerScriptInclude(); req.javaFunctionCalls()&#10;" probe_time="2317" result_code="900000"><result error="Caused by error in JavaScript probe 'Anything' at line 1&#10;&#10;==&gt; 1: var req = new midServerScriptInclude(); req.javaFunctionCalls()&#10;"><output>Evaluation error: Caused by error in JavaScript probe 'Anything' at line 1

==&gt; 1: var req = new midServerScriptInclude(); req.javaFunctionCalls()</output></result><parameters><parameter name="agent" value="mid.server.testmidserver"/><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 req = new midServerScriptInclude(); req.javaFunctionCalls()"/><parameter name="processed" value=""/><parameter name="error_string" value=""/><parameter name="sys_id" value="020c83f1dbd0230096e8a0f2ca961962"/><parameter name="sequence" value="1659e0fc6b00000001"/><parameter name="from_host" value=""/><parameter name="sys_created_on" value="2018-09-03 06:12:38"/><parameter name="sys_domain" value="global"/><parameter name="name" value="Anything"/><parameter name="topic" value="JavascriptProbe"/><parameter name="state" value="ready"/><parameter name="queue" value="output"/><parameter name="ecc_queue" value="020c83f1dbd0230096e8a0f2ca961962"/></parameters></results>

https://community.servicenow.com/community?id=community_question&sys_id=181053e5dbdcdbc01dcaf3231f96196c Is your mid server script include Active ?

CY2
Tera Contributor

Yes, it is active.

CY2
Tera Contributor

Thanks Aman,

 

I noticed is my Java File package naming error. 

 

Thankful for your help.

 

Cheers bro!