Problem
- Using Groovy scripting filter in Policy Studio versions 7.7.Aug21, 7.7.Nov21, or 7.7.Feb22 causing "unable to resolve class" errors
- Script may have worked in prior version, with problem after upgrade to an affected version.
- Several Groovy classes may be noted, but recently seen on Json related classes, ex: groovy.json.JsonBuilder, JsonSlurper, JsonOutput, etc
- Policy Studio console and log will show things like:
INVALID There was a problem loading the script: :
javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 3: unable to resolve class groovy.json.JsonBuilder
@ line 3, column 1.
import groovy.json.JsonBuilder;
Resolution
- Several Groovy jars that exist in the API Gateway runtime are missing from Policy Studio 7.7.Aug21, 7.7.Nov21, and 7.7.Feb22.
- This is corrected in 7.7.May2022 and later.
- This can be worked around by importing the needed jars into Policy Studio > file bar > window > preferences > Runtime Dependencies.
- First obtain and have present on your PS system the needed Groovy jar(s) from an API Gateway instance running the same version as your PS. Ex: copy groovy-json-direct-2.5.13.jar and groovy-json-2.5.13.jar from <API GW location>/apigateway/system/lib/modules
- Add as runtime dependencies and restart policystudio with -clean option.
- Please see the following for how to add additional jars to PS: doc link.