cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Support for gson

vipulk10
New Contributor III

hi all,
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.

8 REPLIES 8

sriram
Former Employee

sys.path.append() can be used to import external jars to a script (say Python) that you may have in place.

Steps:

  1. 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>/โ€ฆ)
  2. If you have multiple node(s) dedicated to run the SnapLogic service, repeat Step (1) for all nodes
  3. Update your script in the โ€œScriptโ€ snap to import the external library as follows:

import sys
.
.
sys.path.append(โ€˜/opt/snaplogic/<DIR_FOR_EXT_JARS>/sample.jarโ€™)
.
.

Note: The above method would work only for a โ€œScriptโ€ snap based pipeline execution(s) done on Groundplex node(s).

vipulk10
New Contributor III

would definitely try this thanks

Hi ,

Is there an option, so that we can refer the jar from sldb rather than keeping it on the groundplex ?

Thanks!

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.