Unable to call method in custom jars placed in extlib folder on Mid Server
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2014 06:52 AM
Hello,
I have a requirement to integrate a third party application with Service-now utilizing the api exposed by them. The jar is uploaded to the extlib folder using the JAR Files module. When I call the methods in the package using the Javascript Probe, I get the output in the ECC queue as :
TypeError: [JavaPackage org.demo.test] is not a function.
However, when I place the jar in the lib folder and invoke the package call using the Javascript Probe, I get the proper results in the ECC queue. I checked in the wrapper.conf file on the midserver that both the folders were present in the classpath as follows:
wrapper.java.classpath.1=lib/*.jar
wrapper.java.classpath.2=extlib/*.jar
Can someone please tell me what is missing in the mid-server configuration so as to call the jar from the extlib folder ?
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2018 12:10 PM
When you synch a jar file to the mid servers, it goes to the agent/extlib subdirectory of every mid.
The conf/wrapper.conf file controls the classpath, allowing the mid to find the jars:
wrapper.conf:wrapper.java.classpath.1=lib/*.jar
wrapper.conf:wrapper.java.classpath.2=extlib/*.jar
(These settings can be adjusted in conf/wrapper-override.conf so you don't lose customizations on upgrade.)
That's it. Do note that the standard jar filers in the lib directory appear on the classpath before the synched ones in extlib, so don't overlap the existing ones, or you'll call the Out of Box classes and not your own.
- Tim.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 05:45 AM
Hi Kshitij,
Did you get this working?
What is the resolution. Could you please share.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2021 09:34 AM
I'm also running into this issue. Was anyone able to figure out the solution?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 07:22 AM
For those who run across this in the future, if you structure your JAR files in the instance, where you create your own folder, and then upload the files into that structure, you will need to add that path directly into the wapper.conf file.
wrapper.java.classpath.3=extlib/(your custom folder)/*.jar for it to be found.
If you attach all of your files at a top level, where the files are copied down to the extlib folder directly, you will not need to add the path.