From 4eb07e3c15807c4f96c1a4fa196a4118c0bfa330 Mon Sep 17 00:00:00 2001 From: guoxiolong <275520895@qq.com> Date: Tue, 9 May 2023 23:34:03 +0800 Subject: [PATCH] Add JBoss support through mount agent by ModuleClassloader. (#527) - Change the classloader to locate the agent path in AgentPackagePath, from `SystemClassLoader` to AgentPackagePath's loader. --- CHANGES.md | 1 + .../apache/skywalking/apm/agent/core/boot/AgentPackagePath.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index a044ed561..abc5b1563 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ Release Notes. * [Chore] Exclude org.checkerframework:checker-qual and com.google.j2objc:j2objc-annotations * [Chore] Exclude proto files in the generated jar * Fix Jedis-2.x plugin can not get host info in jedis 3.3.x+ +* Change the classloader to locate the agent path in AgentPackagePath, from `SystemClassLoader` to AgentPackagePath's loader. #### Documentation diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.java index 611def07d..125cdd1fe 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.java @@ -49,7 +49,7 @@ public class AgentPackagePath { private static File findPath() throws AgentPackageNotFoundException { String classResourcePath = AgentPackagePath.class.getName().replaceAll("\\.", "/") + ".class"; - URL resource = ClassLoader.getSystemClassLoader().getResource(classResourcePath); + URL resource = AgentPackagePath.class.getClassLoader().getResource(classResourcePath); if (resource != null) { String urlString = resource.toString();