Hi,
I’m implementing a managed system using the Groovy script connector, and I’d like to know if it’s possible to add custom JAR libraries for use within the scripts. My specific use case is that I already have libraries that handle the mapping of requests and responses for that particular system’s API.
I’ve already found the documentation on how to allow packages inside OpenIAM.
Thanks!
Cristhian
Hello Cristhian,
To use custom JAR libraries within the Groovy script connector, you’ll need to whitelist the required packages. You can refer to the documentation below for guidance on how to do this:
Whitelisting Packages – OpenIAM Documentation
In the case of the Groovy script connector, you will also need to modify the start.sh
file used to launch the connector JAR by including the necessary libraries. Once you’ve updated the start.sh
file with your libraries, restart the connector using the modified script to apply the changes.
Thanks,
Ameet
Hello Ameet!
Regarding the modification of the start.sh
file to include the JAR files, the -cp flag of Java should be used?
Thanks!
Cristhian
Hello Cristhian,
In this case, there’s no need to use the -cp
flag. Instead, we’re specifying the required package access using the -D
system property, like so:
Dorg.openiam.groovy.extra.whitelist.package=com.ibm.db2.cmx.internal.json4j,java.io,java.sql,org.apache.commons.io
This ensures the necessary packages are available for Groovy scripting without modifying the classpath.
I’ve also added a sample start.sh
file for your reference — feel free to use or adapt it as needed.
Thanks,
Ameet
start.sh (562 Bytes)
Hi Ameet,
Thanks for the example!
Regarding the JAR files that contain the packages I want to allow — where should those be located?
Thanks again!
Hello Cristhian,
The JAR files that contain the packages you want to allow should be placed in a location that is accessible to the application’s runtime environment — typically, this means adding them to the classpath or placing them in a designated lib
directory.