Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GraalVM] Uncaught exception java.lang.NoClassDefFoundError: Could not initialize class jnr.unixsocket.UnixSocketChannel in dd-profiler-http-dispatcher #7978

Open
khannedy opened this issue Nov 20, 2024 · 3 comments

Comments

@khannedy
Copy link

khannedy commented Nov 20, 2024

We use datadog agent in native-image graalvm, but when deploy, we get error class not found


Nov 20, 2024 @ 10:20:02.241 | [dd.trace 2024-11-20 10:20:02:241 +0700] [dd-profiler-http-dispatcher] ERROR java.util.concurrent.ThreadPoolExecutor$Worker - Uncaught exception java.lang.NoClassDefFoundError: Could not initialize class jnr.unixsocket.UnixSocketChannel in dd-profiler-http-dispatcher
-- | --

  | Nov 20, 2024 @ 10:20:02.241 | java.lang.NoClassDefFoundError: Could not initialize class jnr.unixsocket.UnixSocketChannel

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.common.socket.UnixDomainSocketFactory.createSocket(UnixDomainSocketFactory.java:38)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:241)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.connection.RealConnection.connect(RealConnection.java:167)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:258)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:127)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:257)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.RealCall$AsyncCall.execute(RealCall.java:201)

  | Nov 20, 2024 @ 10:20:02.241 | at datadog.okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)

  | Nov 20, 2024 @ 10:20:02.241 | at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)

  | Nov 20, 2024 @ 10:20:02.241 | at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)

  | Nov 20, 2024 @ 10:20:02.241 | at [email protected]/java.lang.Thread.runWith(Thread.java:1596)

  | Nov 20, 2024 @ 10:20:02.241 | at [email protected]/java.lang.Thread.run(Thread.java:1583)

  | Nov 20, 2024 @ 10:20:02.241 | at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:833)

  | Nov 20, 2024 @ 10:20:02.241 | at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:211)

  | Nov 20, 2024 @ 10:19:49.487 | [dd.trace 2024-11-20 10:19:49:486 +0700] [dd-task-scheduler] INFO datadog.communication.monitor.DDAgentStatsDConnection - Detected /var/run/datadog/dsd.socket.  Using it to send StatsD data.

  | Nov 20, 2024 @ 10:19:48.689 | [dd.trace 2024-11-20 10:19:48:689 +0700] [dd-task-scheduler] WARN com.datadog.profiling.controller.openjdk.events.SmapEntryFactory - Smap entry events could not be registered due to missing systemMap operation


we build the image using this command

RUN native-image  \
    -H:+UnlockExperimentalVMOptions \
    -H:Name=/app/application \
    -J-javaagent:/app/agent/dd-java-agent.jar \
    -J-Ddd.profiling.enabled=true \
    --enable-monitoring=heapdump,jfr \
    --initialize-at-build-time="datadog.trace.api.Functions\$PrefixJoin,datadog.trace.bootstrap.instrumentation.decorator.BaseDecorator,datadog.trace.bootstrap.instrumentation.decorator.AsyncResultDecorator,datadog.trace.instrumentation.reactor.core.ReactorAsyncResultSupportExtension,datadog.trace.instrumentation.reactivestreams.ReactiveStreamsAsyncResultSupportExtension" \
    --verbose \
    --static \
    --libc=musl \
    --allow-incomplete-classpath \
    --report-unsupported-elements-at-runtime \
    -cp "$(cat /app/classpath.txt)" $(cat /app/mainclass.txt)
@khannedy
Copy link
Author

we use lates datadog library from : https://dtdg.co/latest-java-tracer

@mcculls
Copy link
Contributor

mcculls commented Nov 20, 2024

Hi @khannedy, dd-java-agent does not currently support using unix-domain sockets with native-image - you have to use ports

@khannedy
Copy link
Author

thanks for the info @mcculls

it's working if using http port

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants