kamon-io / Kamon

Distributed Tracing, Metrics and Context Propagation for applications running on the JVM
https://kamon.io
Other
1.41k stars 328 forks source link

Latest 2.7.2 leads to NoClassDefFoundError #1341

Closed jchapuis closed 5 months ago

jchapuis commented 5 months ago

Updating to the latest 2.7.2 version makes our services crash at startup with

Unable to start Kanela Agent. Please remove -javaagent from your startup arguments and contact Kanela support.:

 java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest      at 

 kamon.instrumentation.apache.httpclient.ApacheHttpClientInstrumentation.<init>(ApacheHttpClientInstrumentation.scala:26)
Dichotomia commented 5 months ago

Same problem here

[main] ERROR 2024-05-27 09:10:11 Logger : Unable to start Kanela Agent. Please remove -javaagent from your startup arguments and contact Kanela support.: java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest at kamon.instrumentation.apache.httpclient.ApacheHttpClientInstrumentation.<init>(ApacheHttpClientInstrumentation.scala:26) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) at java.base/java.lang.reflect.ReflectAccess.newInstance(Unknown Source) at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(Unknown Source) at java.base/java.lang.Class.newInstance(Unknown Source) at kanela.agent.InstrumentationLoader.lambda$loadInstrumentation$b85f757d$1(InstrumentationLoader.java:58) at kanela.agent.libs.io.vavr.control.Try.of(Try.java:75) at kanela.agent.InstrumentationLoader.loadInstrumentation(InstrumentationLoader.java:56) at kanela.agent.InstrumentationLoader.lambda$null$1(InstrumentationLoader.java:46) at kanela.agent.libs.io.vavr.collection.List.flatMap(List.java:902) at kanela.agent.InstrumentationLoader.lambda$load$4(InstrumentationLoader.java:46) at kanela.agent.libs.io.vavr.collection.List.map(List.java:1042) at kanela.agent.InstrumentationLoader.load(InstrumentationLoader.java:43) at kanela.agent.Kanela.lambda$null$0(Kanela.java:78) at kanela.agent.util.classloader.InstrumentationClassPath.use(InstrumentationClassPath.java:84) at kanela.agent.Kanela.lambda$start$1(Kanela.java:67) at kanela.agent.util.Execution.timed(Execution.java:32) at kanela.agent.util.Execution.runWithTimeSpent(Execution.java:41) at kanela.agent.Kanela.start(Kanela.java:66) at kanela.agent.Kanela.premain(Kanela.java:46) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpUriRequest at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) at kamon.instrumentation.apache.httpclient.ApacheHttpClientInstrumentation.<init>(ApacheHttpClientInstrumentation.scala:26) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) at java.base/java.lang.reflect.ReflectAccess.newInstance(Unknown Source) at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(Unknown Source) at java.base/java.lang.Class.newInstance(Unknown Source) at kanela.agent.InstrumentationLoader.lambda$loadInstrumentation$b85f757d$1(InstrumentationLoader.java:58) at kanela.agent.libs.io.vavr.control.Try.of(Try.java:75) at kanela.agent.InstrumentationLoader.loadInstrumentation(InstrumentationLoader.java:56) at kanela.agent.InstrumentationLoader.lambda$null$1(InstrumentationLoader.java:46) at kanela.agent.libs.io.vavr.collection.List.flatMap(List.java:902) at kanela.agent.InstrumentationLoader.lambda$load$4(InstrumentationLoader.java:46) at kanela.agent.libs.io.vavr.collection.List.map(List.java:1042) at kanela.agent.InstrumentationLoader.load(InstrumentationLoader.java:43) at kanela.agent.Kanela.lambda$null$0(Kanela.java:78) at kanela.agent.util.classloader.InstrumentationClassPath.use(InstrumentationClassPath.java:84) at kanela.agent.Kanela.lambda$start$1(Kanela.java:67) at kanela.agent.util.Execution.timed(Execution.java:32) at kanela.agent.util.Execution.runWithTimeSpent(Execution.java:41) at kanela.agent.Kanela.start(Kanela.java:66) at kanela.agent.Kanela.premain(Kanela.java:46) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)

amiguez commented 5 months ago

This issue is reproducible based on the g8 template: https://github.com/theiterators/pekko-http-quickstart-scala.g8

disabling apache http client instrumentalization allows the service to start.

kanela.modules.apache-httpclient.enabled = no

Dichotomia commented 5 months ago

I think it is related to https://github.com/kamon-io/Kamon/pull/1330

@rg-p

essobedo commented 5 months ago

FYI, this issue seems to be fixed by https://github.com/kamon-io/Kamon/pull/1343 which is part of 2.7.3 that has just been released so upgrading to 2.7.3 fixed the issue on my side

hughsimpson commented 5 months ago

Thanks for the feedback @essobedo, closing this