From 1c3a3749b8184c57000fa1ffba9b1b62c1447de7 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Thu, 24 Oct 2024 09:02:43 +0300 Subject: [PATCH] Delegate loading of java package to platform loader (#12505) Co-authored-by: Trask Stalnaker --- .../opentelemetry/javaagent/bootstrap/AgentClassLoader.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/javaagent-bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/AgentClassLoader.java b/javaagent-bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/AgentClassLoader.java index 35f9079ab6d2..23bfe2a626cd 100644 --- a/javaagent-bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/AgentClassLoader.java +++ b/javaagent-bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/AgentClassLoader.java @@ -486,9 +486,10 @@ public PlatformDelegatingClassLoader() { @Override protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { // prometheus exporter uses jdk http server, load it from the platform class loader - // some custom extensions use java.sql classes, make these available to agent and extensions + // some custom extensions use java.* classes which are not in the boot loader such as + // java.sql.* and java.net.http.* if (name != null - && (name.startsWith("com.sun.net.httpserver.") || name.startsWith("java.sql."))) { + && (name.startsWith("com.sun.net.httpserver.") || name.startsWith("java."))) { return platformClassLoader.loadClass(name); } return Class.forName(name, false, null);