Receiving Input ECC record error string as "No Sensors defined"

jobby_ek
Giga Contributor

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

1 ACCEPTED SOLUTION

jobby_ek
Giga Contributor

Looks like i missed to add default constructor in Java code.


View solution in original post

3 REPLIES 3

nasrin786
Kilo Expert

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


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


jobby_ek
Giga Contributor

Looks like i missed to add default constructor in Java code.