diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java index f8cfe6eb1ca8..8cf043d0e4d3 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java @@ -137,7 +137,6 @@ private static void installBytebuddyAgent( .with(new RedefinitionDiscoveryStrategy()) .with(AgentBuilder.DescriptionStrategy.Default.POOL_ONLY) .with(AgentTooling.poolStrategy()) - .with(new ClassLoadListener()) .with(AgentTooling.transformListener()) .with(AgentTooling.locationStrategy()); if (JavaModule.isSupported()) { @@ -172,6 +171,7 @@ private static void installBytebuddyAgent( agentListener.beforeAgent(autoConfiguredSdk); } + agentBuilder = agentBuilder.with(new ClassLoadListener()); agentBuilder = configureIgnoredTypes(sdkConfig, extensionClassLoader, agentBuilder); int numberOfLoadedExtensions = 0;