DataDog / dd-trace-java

Datadog APM client for Java
https://docs.datadoghq.com/tracing/languages/java
Apache License 2.0
583 stars 290 forks source link

Ddtrace version >0.106.0 in the window environment does not support springboot 1.3.5 #6398

Open lrwh opened 10 months ago

lrwh commented 10 months ago

I have a demo with the following basic configuration information:

Run

java -javaagent:dd-java-agent-1.21.0.jar -jar springboot-server2.jar

After starting the service using the agent, some abnormal information is as follows:

[dd.trace 2023-12-20 11:16:01:244 +0800] [main] ERROR datadog.trace.agent.tooling.HelperInjector - Failed to inject helper classes - instrumentation.class=LoggingEventInstrumentation instrumentation.target.classloader=org.springframework.boot.loader.LaunchedURLClassLoader@32c4e8b2 instrumentation.target.class=class ch.qos.logback.classic.spi.LoggingEvent
java.lang.IllegalStateException: Could not locate class file for datadog.trace.agent.tooling.log.UnionMap
        at net.bytebuddy.dynamic.ClassFileLocator$Resolution$Illegal.resolve(ClassFileLocator.java:121)
        at datadog.trace.agent.tooling.HelperInjector.getHelperMap(HelperInjector.java:101)
        at datadog.trace.agent.tooling.HelperInjector.transform(HelperInjector.java:132)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.doTransform(AgentBuilder.java:11897)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.transform(AgentBuilder.java:11834)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.access$1700(AgentBuilder.java:11551)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer$LegacyVmDispatcher.run(AgentBuilder.java:12234)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer$LegacyVmDispatcher.run(AgentBuilder.java:12174)
        at java.security.AccessController.doPrivileged(Native Method)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.doPrivileged(AgentBuilder.java)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.transform(AgentBuilder.java:11743)
        at datadog.trace.agent.tooling.bytebuddy.DDClassFileTransformer.transform(DDClassFileTransformer.java:44)
        at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
        at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170)
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:419)
        at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
        at ch.qos.logback.classic.Logger.log(Logger.java:765)
        at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:131)
        at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:81)
        at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:60)
        at org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:531)
        at org.springframework.boot.logging.logback.SpringPropertyAction.getValue(SpringPropertyAction.java:64)
        at org.springframework.boot.logging.logback.SpringPropertyAction.begin(SpringPropertyAction.java:56)
        at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:269)
        at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:145)
        at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:128)
        at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
        at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:155)
        at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:142)
        at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:103)
        at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
        at org.springframework.boot.logging.logback.LogbackLoggingSystem.configureByResourceUrl(LogbackLoggingSystem.java:163)
        at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:135)
        at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSpecificConfig(AbstractLoggingSystem.java:57)
        at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:47)
        at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:106)
        at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:282)
        at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:255)
        at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:224)
        at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:200)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121)
        at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:111)
        at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:65)
        at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
        at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:330)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
        at com.zy.observable.server.ServerApplication.main(ServerApplication.java:12)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
        at java.lang.Thread.run(Thread.java:750)
[dd.trace 2023-12-20 11:16:01:288 +0800] [main] DEBUG datadog.trace.agent.tooling.AgentInstaller$TransformLoggingListener - Transformation failed - instrumentation.target.class=ch.qos.logback.classic.spi.LoggingEvent instrumentation.target.classloader=org.springframework.boot.loader.LaunchedURLClassLoader@32c4e8b2
java.lang.RuntimeException: java.lang.IllegalStateException: Could not locate class file for datadog.trace.agent.tooling.log.UnionMap
        at datadog.trace.agent.tooling.HelperInjector.transform(HelperInjector.java:156)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.doTransform(AgentBuilder.java:11897)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.transform(AgentBuilder.java:11834)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.access$1700(AgentBuilder.java:11551)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer$LegacyVmDispatcher.run(AgentBuilder.java:12234)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer$LegacyVmDispatcher.run(AgentBuilder.java:12174)
        at java.security.AccessController.doPrivileged(Native Method)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.doPrivileged(AgentBuilder.java)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.transform(AgentBuilder.java:11743)
        at datadog.trace.agent.tooling.bytebuddy.DDClassFileTransformer.transform(DDClassFileTransformer.java:44)
        at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
        at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170)
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:419)
        at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
        at ch.qos.logback.classic.Logger.log(Logger.java:765)
        at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:131)
        at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:81)
        at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:60)
        at org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:531)
        at org.springframework.boot.logging.logback.SpringPropertyAction.getValue(SpringPropertyAction.java:64)
        at org.springframework.boot.logging.logback.SpringPropertyAction.begin(SpringPropertyAction.java:56)
        at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:269)
        at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:145)
        at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:128)
        at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
        at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:155)
        at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:142)
        at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:103)
        at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
        at org.springframework.boot.logging.logback.LogbackLoggingSystem.configureByResourceUrl(LogbackLoggingSystem.java:163)
        at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:135)
        at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSpecificConfig(AbstractLoggingSystem.java:57)
        at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:47)
        at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:106)
        at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:282)
        at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:255)
        at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:224)
        at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:200)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121)
        at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:111)
        at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:65)
        at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
        at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:330)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
        at com.zy.observable.server.ServerApplication.main(ServerApplication.java:12)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
        at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.IllegalStateException: Could not locate class file for datadog.trace.agent.tooling.log.UnionMap
        at net.bytebuddy.dynamic.ClassFileLocator$Resolution$Illegal.resolve(ClassFileLocator.java:121)
        at datadog.trace.agent.tooling.HelperInjector.getHelperMap(HelperInjector.java:101)
        at datadog.trace.agent.tooling.HelperInjector.transform(HelperInjector.java:132)
        ... 66 more
[dd.trace 2023-12-20 11:16:01:405 +0800] [main] DEBUG datadog.trace.agent.tooling.context.ShouldInjectFieldsMatcher - Added context-store field - instrumentation.target.class=org.springframework.boot.autoconfigure.BackgroundPreinitializer$1 instrumentation.target.context=java.lang.Runnable->datadog.trace.bootstrap.instrumentation.java.concurrent.State
[dd.trace 2023-12-20 11:16:01:407 +0800] [main] DEBUG datadog.trace.agent.tooling.Instrumenter$Default - Instrumentation applied - instrumentation.names=[java_concurrent,runnable] instrumentation.class=datadog.trace.instrumentation.java.concurrent.RunnableInstrumentation instrumentation.target.classloader=org.springframework.boot.loader.LaunchedURLClassLoader@32c4e8b2 instrumentation.target.class=null
[dd.trace 2023-12-20 11:16:01:409 +0800] [main] DEBUG datadog.trace.agent.tooling.AgentInstaller$TransformLoggingListener - Transformation failed - instrumentation.target.class=org.springframework.boot.autoconfigure.BackgroundPreinitializer$1 instrumentation.target.classloader=org.springframework.boot.loader.LaunchedURLClassLoader@32c4e8b2
net.bytebuddy.pool.TypePool$Resolution$NoSuchTypeException: Cannot resolve type description for datadog.trace.instrumentation.java.concurrent.RunnableInstrumentation$RunnableAdvice
        at net.bytebuddy.pool.TypePool$Resolution$Illegal.resolve(TypePool.java:167)
        at net.bytebuddy.pool.TypePool$Default$WithLazyResolution$LazyTypeDescription.delegate(TypePool.java:1088)
        at net.bytebuddy.description.type.TypeDescription$AbstractBase$OfSimpleType$WithDelegation.getDeclaredMethods(TypeDescription.java:8375)
        at net.bytebuddy.asm.Advice.to(Advice.java:349)
        at net.bytebuddy.asm.Advice$WithCustomMapping.to(Advice.java:14293)
        at net.bytebuddy.agent.builder.AgentBuilder$Transformer$ForAdvice$Entry$ForUnifiedAdvice.resolve(AgentBuilder.java:3076)
        at net.bytebuddy.agent.builder.AgentBuilder$Transformer$ForAdvice.transform(AgentBuilder.java:2858)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.doTransform(AgentBuilder.java:11897)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.transform(AgentBuilder.java:11834)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.access$1700(AgentBuilder.java:11551)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer$LegacyVmDispatcher.run(AgentBuilder.java:12234)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer$LegacyVmDispatcher.run(AgentBuilder.java:12174)
        at java.security.AccessController.doPrivileged(Native Method)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.doPrivileged(AgentBuilder.java)
        at net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.transform(AgentBuilder.java:11743)
        at datadog.trace.agent.tooling.bytebuddy.DDClassFileTransformer.transform(DDClassFileTransformer.java:44)
        at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
        at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170)
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at org.springframework.boot.autoconfigure.BackgroundPreinitializer.onApplicationEvent(BackgroundPreinitializer.java:44)
        at org.springframework.boot.autoconfigure.BackgroundPreinitializer.onApplicationEvent(BackgroundPreinitializer.java:37)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121)
        at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:111)
        at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:65)
        at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
        at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:330)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
        at com.zy.observable.server.ServerApplication.main(ServerApplication.java:12)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
        at java.lang.Thread.run(Thread.java:750)
[dd.trace 2023-12-20 11:16:01:438 +0800] [background-preinit] DEBUG datadog.trace.agent.tooling.context.ShouldInjectFieldsMatcher - Added context-store field - instrumentation.target.class=org.springframework.boot.autoconfigure.BackgroundPreinitializer$MessageConverterInitializer instrumentation.target.context=java.lang.Runnable->datadog.trace.bootstrap.instrumentation.java.concurrent.State
[dd.trace 2023-12-20 11:16:01:438 +0800] [background-preinit] DEBUG datadog.trace.agent.tooling.Instrumenter$Default - Instrumentation applied - instrumentation.names=[java_concurrent,runnable] instrumentation.class=datadog.trace.instrumentation.java.concurrent.RunnableInstrumentation instrumentation.target.classloader=org.springframework.boot.loader.LaunchedURLClassLoader@32c4e8b2 instrumentation.target.class=null

The same program, if the operating system is switched to Linux, will not have this problem.

The agent version has been changed to 0.106.0, and both Linux and window probes are running normally.

The following versions all have exceptions:

The following versions of the program run normally in both Windows and Linux environments:

mcculls commented 10 months ago

Hi @lrwh - are you able to share the demo application somewhere?

lrwh commented 10 months ago

@mcculls Thank you for your reply,This is my demo https://github.com/lrwh/observable-demo/tree/main/springboot-server2

use command:

java -javaagent:dd-java-agent-1.21.0.jar -jar springboot-server2.jar

Thinks.