- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2016 10:25 PM
Hi All,
I been doing some research on Usage of Custom Jar Files on a MID Server. Thanks to John, there is a good example Video: Use Custom Jar Files on a MID Server-John Andersen how to do that. By creating a ecc queue record with below details, we can instantiate our Java code.
agent : mid.server.JOB_MIDServer
topic : JavascriptProbe
name: Test JAR file
queue: output
state: ready
payload:
<parameters>
<parameter name = "script" value = "var wsc = new Packages.com.snc.test.zipper.TestHttpConnection();" />
</parameters>
--------------------------------------
Sample Java Code:
package com.snc.test.zipper;
import java.io.IOException;
public class TestHttpConnection {
public static void main(String[] args) throws IOException {
System.out.println("Hello");
}
}
After submitting this queue, an input entry is received with error string as "no sensors defined". I looked around in community to find what this error is , few developers encountered this error when they used with REST and SOAP calls using a MID server. But am not using any web services call, just instantiate the Java class and in response i have to get the message.I have verified whether JAR file is moved to mid server -> exlib folder. Any help much appreciated.
Thanks in Advance!
Best Regards,
Jobby EK
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2016 08:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2016 10:44 PM
Hi Jobby,
Navigate to MID Server / Script Includes and click CSMIDServerRemoteFileImport to Edit
Line 67 after "new" prepend "java." with "Packages."
Line 113 after "newInstance" prepend "java." with "Packages."
Submit and run again
67: var userpass = new Packages.java.lang.String(this.probeParameters.instanceUser + ":" + this.probeParameters.instancePassword);
113: var data = new Packages.java.lang.reflect.Array.newInstance(Packages.java.lang.Byte.TYPE, 4096);
Please go through these links :
Remote File Importer (Import Files from a MID Server) on ServiceNow Share:
http://wiki.servicenow.com/index.php?title=Evaluating_the_No_Sensors_Defined_Message#gsc.tab=0
Thanks&Regards,
Nasrin Syed
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 02:15 AM
Hi Nasrin,
Thanks for the reply, Am not using the solution from Cloud Sherpas to import files from a MID server.
if i set skip_sensor to true in parameter, not getting that error.
<parameters>
<parameter name="skip_sensor" value="true"/>
<parameter name = "script" value = "var wsc = new Packages.com.snc.test.zipper.TestHttpConnection();" />
</parameters>
But am not getting the message ("Hello") from Java code.
Best Regards,
Jobby EK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2016 08:07 AM
Looks like i missed to add default constructor in Java code.