ScalaConsultants / mesmer

OpenTelemetry agent for Scala applications
https://mesmer.io
Apache License 2.0
71 stars 12 forks source link

Mesmer agent fails with ClassNotFoundException #785

Open will-sargent-eero opened 7 months ago

will-sargent-eero commented 7 months ago

I am using javaagent 1.32.1-aws with mesmer 0.9.0 using -Dotel.javaagent.extensions=mesmer/mesmer-otel-extension.jar

When I start the agent, I get the following stacktrace

Exception in thread "Thread-8" java.lang.NoClassDefFoundError: io/scalac/mesmer/core/module/Module
    at io.scalac.mesmer.otelextension.instrumentations.akka.stream.AkkaStreamMonitorExtension$.register(AkkaStreamMonitorExtension.scala:204)
    at io.scalac.mesmer.otelextension.instrumentations.akka.stream.AkkaStreamMonitorExtension$.$anonfun$registerWhenSystemIsInitialized$2(AkkaStreamMonitorExtension.scala:196)
    at scala.util.Try$.apply(Try.scala:210)
    at io.scalac.mesmer.core.util.Retry$.retry(Retry.scala:11)
    at io.scalac.mesmer.core.util.Retry$.retryWithPrecondition(Retry.scala:25)
    at io.scalac.mesmer.otelextension.instrumentations.akka.stream.AkkaStreamMonitorExtension$.io$scalac$mesmer$otelextension$instrumentations$akka$stream$AkkaStreamMonitorExtension$$registerWhenSystemIsInitialized(AkkaStreamMonitorExtension.scala:196)
    at io.scalac.mesmer.otelextension.instrumentations.akka.stream.AkkaStreamMonitorExtension$$anon$1.run(AkkaStreamMonitorExtension.scala:191)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: io.scalac.mesmer.core.module.Module
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    ... 8 more

Opening up the jar assembly shows that io.scalac.mesmer.core.module.Module is present, so I think it's a classloader issue -- or, potentially, it doesn't work with a version after 1.24.