Loading System libraries in MID server using Java Class

Ebe
Giga Contributor

Hi Folks,

I am trying to develop a POC in my personal ServiceNow instance and facing issue with MID server Java Call. So, to give an overview of what I am trying to do... 

-> I am trying to call Java class file from MID server and return the results in ServiceNow instance to build some reports and charts.

-> To do this, I have installed and configured my MID server. 

-> Deployed JAR file into ServiceNow instance (verified it in ~/extlib/ folder as well)

-> Start the MID Server and make sure it is up and running.

-> Call my java class by defining a "Queue" of JavascriptProbe. This is how my queue code looks like

<parameters>
<parameter name="script" value="var wsc = new Packages.com.client.TestClass(); wsc.searchByAttributes('Bobby','Jones','null','null','null');"/>
</parameters>

-> That particular java class in MID server has a line of code to load System library. (System.loadLibrary("G2"))

-> I have also verified that library is available in MID server "java.library.path" and also placed it under /usr/lib/ and /usr/lib/x86_64-linux-gnu/

After all these setup, when I executed the queue, no matter what I get below output all the time. 

Evaluation error: JavaScript evaluation error on:
var wsc = new Packages.com.client.TestClass(); wsc.searchByAttributes('Bobby','Jones','null','null','null');
Root cause of JavaScriptException: java.lang.UnsatisfiedLinkError

Please let me know how can I load libray in MID server from ServiceNow queue? Is there any alternate way to accomplish this? Any thoughts are greatly appreciated!

1 ACCEPTED SOLUTION

Ebe
Giga Contributor

I couldn't fix this issue since this involves accessing System Libraries of MID server in Service Now server. So, I have hosted API in MID server as Web Service and was able to access it outside without any issue. 

View solution in original post

3 REPLIES 3

Ebe
Giga Contributor

does any one have any insights on this? Any help is greatly appreciated!

Ebe
Giga Contributor

I couldn't fix this issue since this involves accessing System Libraries of MID server in Service Now server. So, I have hosted API in MID server as Web Service and was able to access it outside without any issue. 

Hi Ebe,

 

Could you please elaborate step-by-step what exactly you did?