This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new 7ab8b6407a fix classloader issue, fixes #8369 (#8382)
7ab8b6407a is described below
commit 7ab8b6407add1e840b1102eabe1a7b80019b48c1
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Tue Sep 15 15:29:40 2026 +0200
fix classloader issue, fixes #8369 (#8382)
---
.../org/apache/hop/core/plugins/HopURLClassLoader.java | 14 +++++++++++++-
.../org/apache/hop/core/plugins/HopURLClassLoaderTest.java | 8 ++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git
a/core/src/main/java/org/apache/hop/core/plugins/HopURLClassLoader.java
b/core/src/main/java/org/apache/hop/core/plugins/HopURLClassLoader.java
index 49c384b10e..3c59ea116e 100644
--- a/core/src/main/java/org/apache/hop/core/plugins/HopURLClassLoader.java
+++ b/core/src/main/java/org/apache/hop/core/plugins/HopURLClassLoader.java
@@ -108,8 +108,20 @@ public class HopURLClassLoader extends URLClassLoader {
return clz;
}
+ /**
+ * Packages a plugin must share with the core classloader so objects can
cross the boundary (Hop
+ * core types, the Jackson streaming/databind API, SLF4J). Jackson *modules*
are deliberately not
+ * listed: plugins bring their own — e.g. jackson-module-scala is compiled
per Scala version, so
+ * the Beam engine (Scala 2.12) and the native Spark engine (Scala 2.13)
each need the copy in
+ * their own lib, and a parent-first lookup of the wrong one fails at
runtime with "no Creators"
+ * when Spark deserializes its own Scala classes.
+ */
private static final String[] SYSTEM_PARENT_FIRST_PACKAGES = {
- "org.apache.hop.core.", "com.fasterxml.jackson.", "org.slf4j."
+ "org.apache.hop.core.",
+ "com.fasterxml.jackson.core.",
+ "com.fasterxml.jackson.databind.",
+ "com.fasterxml.jackson.annotation.",
+ "org.slf4j."
};
protected boolean isParentFirst(String name) {
diff --git
a/core/src/test/java/org/apache/hop/core/plugins/HopURLClassLoaderTest.java
b/core/src/test/java/org/apache/hop/core/plugins/HopURLClassLoaderTest.java
index f230b88b4b..e607955543 100644
--- a/core/src/test/java/org/apache/hop/core/plugins/HopURLClassLoaderTest.java
+++ b/core/src/test/java/org/apache/hop/core/plugins/HopURLClassLoaderTest.java
@@ -18,6 +18,7 @@
package org.apache.hop.core.plugins;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -77,6 +78,13 @@ class HopURLClassLoaderTest {
Class<?> hopJsonClass =
loader.loadClass("org.apache.hop.core.json.HopJson");
assertEquals(org.apache.hop.core.json.HopJson.class, hopJsonClass);
assertEquals(getClass().getClassLoader(), hopJsonClass.getClassLoader());
+
+ // Jackson modules are not shared: a plugin's own (e.g. Scala-version
specific) copy must win
+
assertFalse(loader.isParentFirst("com.fasterxml.jackson.module.scala.DefaultScalaModule"));
+
assertFalse(loader.isParentFirst("com.fasterxml.jackson.datatype.jsr310.JavaTimeModule"));
+
assertTrue(loader.isParentFirst("com.fasterxml.jackson.databind.ObjectMapper"));
+
assertTrue(loader.isParentFirst("com.fasterxml.jackson.core.JsonParser"));
+
assertTrue(loader.isParentFirst("com.fasterxml.jackson.annotation.JsonProperty"));
}
}
}