Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Runtime class loading causes crash on 1.52.0; DD Java Agent clashes with OTel Agent JAR

Đang mở
#9,312 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
groovy, java
Lĩnh vực
observability-sre

Hướng nghiên cứu

Bắt đầu với bản tái hiện GroovyClassLoader được cung cấp và chạy nó với cả OTel agent và DD Agent 1.52.0 trong JAVA_OPTS, sau đó so sánh hành vi với DD Agent 1.51.0 và với thứ tự của các agent. Được xem là hoàn tất khi việc tải lớp Groovy trong thời gian chạy không còn bị crash với tổ hợp agent được hỗ trợ và hành vi mong đợi đã được xác minh đối với NoClassDefFoundError được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

type: bug report
Tracer Version(s)

1.52.0

Java Version(s)

21.0.4

JVM Vendor

Other (please specify in comments)

Bug Report

Hi,

My JDK 21 application started crashing at runtime after pulling in the latest DD Java Agent JAR (v1.52.0). At runtime, I am using Groovy to dynamically load a set of classes, and I saw the following error:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during instruction selection: java.lang.NoClassDefFoundError: io/opentelemetry/javaagent/instrumentation/internal/classloader/BootstrapPackagesHelper
java.lang.RuntimeException: java.lang.NoClassDefFoundError: io/opentelemetry/javaagent/instrumentation/internal/classloader/BootstrapPackagesHelper
	at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:972)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:692)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:666)
	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:365)
	at groovy.lang.GroovyClassLoader.lambda$parseClass$2(GroovyClassLoader.java:314)
	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:314)
	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:572)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:585)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:564)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:552)
	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:534)
        <REDACTED>
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:102)
	at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:64)
	at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:40)
Caused by: java.lang.NoClassDefFoundError: io/opentelemetry/javaagent/instrumentation/internal/classloader/BootstrapPackagesHelper
	at groovy.lang.GroovyClassLoader$InnerLoader.loadClass(GroovyClassLoader.java:585)
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
	at groovy.lang.GroovyClassLoader.access$400(GroovyClassLoader.java:90)
	at groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:682)
	at groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:699)
	at groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:704)
	at org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
	at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:938)
	... 21 more
Caused by: java.lang.ClassNotFoundException: io.opentelemetry.javaagent.instrumentation.internal.classloader.BootstrapPackagesHelper
	... 31 more

I am using both the DD Agent JAR as well as the OTel Agent JAR in my Application. The DD Agent is listed first in my Java Opts, and hence takes priority. This was not happening on earlier versions of the DD Agent JAR.

As a work-around, I have reverted to use v1.51.0 and the issue is resolved there. I may also consider trying to re-order the agents, such that the OTel Agent JAR takes precedence. However, curious what may have changed in the DD Agent JAR in this release, which would have caused this. Thanks!

Expected Behavior

Application starts up, with no issue loading classes at runtime.

Reproduction Code
			ClassLoader appClassLoader = MyApplication.class.getClassLoader();
			GroovyClassLoader groovyClassLoader = new GroovyClassLoader(appClassLoader);
			GroovyShell shell = new GroovyShell(groovyClassLoader, binding);

			PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
			Resource[] resources = resolver.getResources("classpath:*.groovy");
			Arrays.sort(resources, Comparator.comparing(Resource::getFilename));
			for (Resource resource: resources) {
				Reader reader = new InputStreamReader(resource.getInputStream());
				shell.evaluate(reader, resource.getFilename());
			}

And, ensure that the JVM JAVA_OPTS has both the OTel (latest) and DD Agent (1.52.0) JARs.

Ngôn ngữ chính
Java
Star
737
Fork
361
Merge trung bình
3 ngày 20 giờ
Pull request đã merge (30 ngày)
173

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DataDog/dd-trace-java

Tất cả issue của DataDog/dd-trace-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.