I m trying to use gson in my script snap by importing the package. but its giving me an error. so does snaplogic support external packages in their script snap apart from standard ones like java.util etc.
sys.path.append() can be used to import external jars to a script (say Python) that you may have in place.
- Place a copy of the package / .jar file that you intend to use as part of the script in a directory on the Groundplex node (say under: /opt/snaplogic/<DIR_FOR_EXT_JARS>/…)
- If you have multiple node(s) dedicated to run the SnapLogic service, repeat Step (1) for all nodes
- Update your script in the “Script” snap to import the external library as follows:
Note: The above method would work only for a “Script” snap based pipeline execution(s) done on Groundplex node(s).
would definitely try this thanks
Is there an option, so that we can refer the jar from sldb rather than keeping it on the groundplex ?
To work with Java (or) Jython based libraries, it is a mandatory requirement for the jar files to be loaded to every Groundplex node (JCC) before referencing them from the Script Snap.
What If SnapLogic is running completely on Cloud ?
Running a script, that leverages Java / Jython libraries is only an option if your organization runs a Groundplex and is not an option on a Cloudplex.
Even when I copy the jars to both the ground nodes, still I am unable to import any methods from the jar. Does jar has to be on specific location ?
The JAR files can be loaded into a location that can be accessed by the SnapLogic (JCC) process. As an example, assets kept under /opt/snaplogic/… can be accessed/read by the JCC process by default.