diff --git a/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/plugin/classloader/PluginClassLoader.java b/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/plugin/classloader/PluginClassLoader.java index 6c74d00c77..368ddcd191 100644 --- a/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/plugin/classloader/PluginClassLoader.java +++ b/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/plugin/classloader/PluginClassLoader.java @@ -20,8 +20,10 @@ import io.sermant.core.config.ConfigManager; import io.sermant.core.plugin.agent.config.AgentConfig; +import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; +import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import java.util.logging.Level; @@ -150,6 +152,17 @@ private Class getClassFromLocalClassLoader(String name) { return clazz; } + @Override + public Enumeration getResources(String name) throws IOException { + // Due to class isolation, the service loader does not obtain the service provider from the parent + // classloader, but returns only the resources in current classloader + if (name.startsWith("META-INF/services/")) { + return findResources(name); + } + + return super.getResources(name); + } + /** * Load classes only through Sermant's own search path, not using localClassLoader, which would otherwise cause * stackoverflow