From 6d2fd3d3de7281cd20693ac424de1a0e5604ad5b Mon Sep 17 00:00:00 2001 From: albertshau Date: Mon, 14 Aug 2023 15:07:33 -0700 Subject: [PATCH] use the plugin classloader for loading scripting engin Fixed a bug that caused the transform to fail in java 11 execution environments like Dataproc 2.1. --- .../main/java/io/cdap/plugin/transform/JavaScriptTransform.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-plugins/src/main/java/io/cdap/plugin/transform/JavaScriptTransform.java b/core-plugins/src/main/java/io/cdap/plugin/transform/JavaScriptTransform.java index c521f760e..e3732d019 100644 --- a/core-plugins/src/main/java/io/cdap/plugin/transform/JavaScriptTransform.java +++ b/core-plugins/src/main/java/io/cdap/plugin/transform/JavaScriptTransform.java @@ -383,7 +383,7 @@ private Object decodeUnion(Object object, List schemas) { } private void init(@Nullable TransformContext context, FailureCollector collector) { - ScriptEngineManager manager = new ScriptEngineManager(); + ScriptEngineManager manager = new ScriptEngineManager(getClass().getClassLoader()); engine = manager.getEngineByName("JavaScript"); try { engine.eval(ScriptConstants.HELPER_DEFINITION);