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

Class not found Kotlin since 1.17 - maven extension #990

Closed
liron58 opened this issue Aug 2, 2023 · 9 comments
Closed

Class not found Kotlin since 1.17 - maven extension #990

liron58 opened this issue Aug 2, 2023 · 9 comments

Comments

@liron58
Copy link

liron58 commented Aug 2, 2023

Component(s)

No response

What happened?

Description

Adding the extension to the pom since version 1.17 causes error after build.
JDK : Eclipse Temurin 17.0.5

Steps to Reproduce

  1. Spring initializer maven project with java
  2. add extension to pom as described in doc
  3. run maven install

Expected Result

build success

Actual Result

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.422 s (Wall Clock)
[INFO] Finished at: 2023-08-02T15:49:38+03:00
[INFO] ------------------------------------------------------------------------
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: kotlin/Unit
at okhttp3.internal.concurrent.TaskQueue.cancelAll(TaskQueue.kt:185)
at okhttp3.internal.connection.RealConnectionPool.evictAll(RealConnectionPool.kt:135)
at okhttp3.ConnectionPool.evictAll(ConnectionPool.kt:57)
at io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter.shutdown(OkHttpGrpcExporter.java:212)
at io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter.shutdown(OtlpGrpcMetricExporter.java:101)
at io.opentelemetry.sdk.metrics.export.PeriodicMetricReader$Scheduled.shutdown(PeriodicMetricReader.java:185)
at io.opentelemetry.sdk.metrics.export.PeriodicMetricReader.shutdown(PeriodicMetricReader.java:100)
at io.opentelemetry.sdk.metrics.SdkMeterProvider.shutdown(SdkMeterProvider.java:133)
at io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder.lambda$build$9(AutoConfiguredOpenTelemetrySdkBuilder.java:374)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: kotlin.Unit
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 10 more

Process finished with exit code 0

Component version

v1.17^

Log output

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.422 s (Wall Clock)
[INFO] Finished at: 2023-08-02T15:49:38+03:00
[INFO] ------------------------------------------------------------------------
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: kotlin/Unit
at okhttp3.internal.concurrent.TaskQueue.cancelAll(TaskQueue.kt:185)
at okhttp3.internal.connection.RealConnectionPool.evictAll(RealConnectionPool.kt:135)
at okhttp3.ConnectionPool.evictAll(ConnectionPool.kt:57)
at io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter.shutdown(OkHttpGrpcExporter.java:212)
at io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter.shutdown(OtlpGrpcMetricExporter.java:101)
at io.opentelemetry.sdk.metrics.export.PeriodicMetricReader$Scheduled.shutdown(PeriodicMetricReader.java:185)
at io.opentelemetry.sdk.metrics.export.PeriodicMetricReader.shutdown(PeriodicMetricReader.java:100)
at io.opentelemetry.sdk.metrics.SdkMeterProvider.shutdown(SdkMeterProvider.java:133)
at io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder.lambda$build$9(AutoConfiguredOpenTelemetrySdkBuilder.java:374)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: kotlin.Unit
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 10 more

Process finished with exit code 0

Additional context

No response

@trask
Copy link
Member

trask commented Aug 2, 2023

cc @cyrille-leclerc @kenfinnigan

@cyrille-leclerc
Copy link
Member

@liron58 we are sorry for the pain. This message is annoying and we will work at fixing it but it should not prevent OTel traces to be properly created.

Can you please:

  • Clarify which integration to the pom did you use? Is it declaring the OTel extension in an <extension> block of pom.xml ? or is it using .mvn/extensions.xml?
  • Indicate us which version of the OTel Maven extension was working with your setup? Was it working ok with v1.16?

@liron58
Copy link
Author

liron58 commented Aug 4, 2023

@cyrille-leclerc

  1. Its happening when using the block inside of pom.xml.
  2. In version 1.16 its working without the errors.
  3. The error indeed doesn't prevent the OTEL traces to be created.

@liron58
Copy link
Author

liron58 commented Aug 7, 2023

@cyrille-leclerc
It happens also in 1.16, do you any idea why it could happen? I have looked online and didn't found any direction

@cyrille-leclerc
Copy link
Member

I see to probable causes:

  • Change in Maven class loading. The regression would not be caused by an upgrade of the Otel Maven extension by by Maven itself
  • Change in OTel SDK, typically a change in the OTel gRPC exporter

if you reproduce the problem with the version 1.16 of the OTel Maven extension, could it be a change in the version of Maven?

@cyrille-leclerc
Copy link
Member

I guess it's caused by the otel SDK shutdown hook. I have to check that using io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder#disableShutdownHook will fix the problem.

I'm sorry for the delay, I have been very busy at work before the vacation season. I'll have much more time in September.

@cyrille-leclerc
Copy link
Member

Reproduced bumping from 1.20.0-alpha to 1.21.0-alpha

1.20.0-alpha:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.052 s
[INFO] Finished at: 2023-08-26T22:48:52+08:00
[INFO] ------------------------------------------------------------------------
[DEBUG] OpenTelemetry: afterSessionEnd
[DEBUG] OpenTelemetry: dispose OpenTelemetrySdkService...
[DEBUG] OpenTelemetry: Shutdown SDK Trace Provider...
[DEBUG] OpenTelemetry: SDK Trace Provider shut down
[DEBUG] OpenTelemetry: OpenTelemetrySdkService disposed
[DEBUG] Shutting down adapter factory; available factories [file-lock, rwlock-local, semaphore-local, noop]; available name mappers [discriminating, file-gav, file-hgav, file-static, gav, static]
[DEBUG] Shutting down 'file-lock' factory
[DEBUG] Shutting down 'rwlock-local' factory
[DEBUG] Shutting down 'semaphore-local' factory
[DEBUG] Shutting down 'noop' factory

1.21.0-alpha:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.076 s
[INFO] Finished at: 2023-08-26T22:47:36+08:00
[INFO] ------------------------------------------------------------------------
[DEBUG] OpenTelemetry: afterSessionEnd
[DEBUG] OpenTelemetry: dispose OpenTelemetrySdkService...
[DEBUG] OpenTelemetry: Shutdown SDK Trace Provider...
[DEBUG] OpenTelemetry: SDK Trace Provider shut down
[DEBUG] OpenTelemetry: OpenTelemetrySdkService disposed
Exception in thread "OkHttp TaskRunner" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Ref$IntRef
	at okhttp3.internal.http2.Http2Connection.shutdown(Http2Connection.kt:419)
	at okhttp3.internal.http2.Http2Connection.close$okhttp(Http2Connection.kt:449)
	at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:627)
	at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:609)
	at okhttp3.internal.concurrent.TaskQueue$execute$1.runOnce(TaskQueue.kt:98)
	at okhttp3.internal.concurrent.TaskRunner.runTask(TaskRunner.kt:116)
	at okhttp3.internal.concurrent.TaskRunner.access$runTask(TaskRunner.kt:42)
	at okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:65)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Ref$IntRef
	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
	... 11 more
[DEBUG] Shutting down adapter factory; available factories [file-lock, rwlock-local, semaphore-local, noop]; available name mappers [discriminating, file-gav, file-hgav, file-static, gav, static]
[DEBUG] Shutting down 'file-lock' factory
[DEBUG] Shutting down 'rwlock-local' factory
[DEBUG] Shutting down 'semaphore-local' factory
[DEBUG] Shutting down 'noop' factory

1.30.0-alpha-SNAPSHOT

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.090 s
[INFO] Finished at: 2023-08-26T22:51:10+08:00
[INFO] ------------------------------------------------------------------------
[DEBUG] OpenTelemetry: afterSessionEnd
[DEBUG] OpenTelemetry: dispose OpenTelemetrySdkService...
[DEBUG] OpenTelemetry: Shutdown SDK Trace Provider...
Aug 26, 2023 10:51:10 PM io.opentelemetry.api.GlobalOpenTelemetry maybeAutoConfigureAndSetGlobal
INFO: AutoConfiguredOpenTelemetrySdk found on classpath but automatic configuration is disabled. To enable, run your JVM with -Dotel.java.global-autoconfigure.enabled=true
[DEBUG] OpenTelemetry: SDK Trace Provider shut down
[DEBUG] OpenTelemetry: OpenTelemetrySdkService disposed
Exception in thread "OkHttp TaskRunner" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Ref$IntRef
	at okhttp3.internal.http2.Http2Connection.shutdown(Http2Connection.kt:419)
	at okhttp3.internal.http2.Http2Connection.close$okhttp(Http2Connection.kt:449)
	at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:627)
	at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:609)
	at okhttp3.internal.concurrent.TaskQueue$execute$1.runOnce(TaskQueue.kt:98)
	at okhttp3.internal.concurrent.TaskRunner.runTask(TaskRunner.kt:116)
	at okhttp3.internal.concurrent.TaskRunner.access$runTask(TaskRunner.kt:42)
	at okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:65)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Ref$IntRef
	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
	... 11 more
[DEBUG] Shutting down adapter factory; available factories [file-lock, rwlock-local, semaphore-local, noop]; available name mappers [discriminating, file-gav, file-hgav, file-static, gav, static]
[DEBUG] Shutting down 'file-lock' factory
[DEBUG] Shutting down 'rwlock-local' factory
[DEBUG] Shutting down 'semaphore-local' factory
[DEBUG] Shutting down 'noop' factory
Aug 26, 2023 10:51:10 PM io.opentelemetry.sdk.trace.SdkTracerProvider shutdown
INFO: Calling shutdown() multiple times.

@cyrille-leclerc
Copy link
Member

@laurit
Copy link
Contributor

laurit commented Oct 5, 2023

Resolved with #1022

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

No branches or pull requests

5 participants