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

NoClassDefFoundError: io/opentelemetry/semconv/HttpAttributes #1232

Closed
yvespp opened this issue Apr 18, 2024 · 9 comments · Fixed by #1233
Closed

NoClassDefFoundError: io/opentelemetry/semconv/HttpAttributes #1232

yvespp opened this issue Apr 18, 2024 · 9 comments · Fixed by #1233
Assignees
Labels
bug Something isn't working
Milestone

Comments

@yvespp
Copy link

yvespp commented Apr 18, 2024

Hi

Yesterday I updated the msgraph-sdk-java from v6.5.1 to v6.6.0, which updates kiota from 1.1.2 to 1.1.4.

Since then I get the following exception:

2024-04-17T19:00:06.002288463+02:00 | ERROR | Error occurred while executing task for trigger IntervalTrigger [id=1_my.corp.directory.DirectoryReader#updateUsers, interval=900000] | : java.util.concurrent.CompletionException: java.lang.NoClassDefFoundError: io/opentelemetry/semconv/HttpAttributes
        at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332)
        at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:347)
        at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:874)
        at java.base/java.util.concurrent.CompletableFuture.uniWhenCompleteStage(CompletableFuture.java:887)
        at java.base/java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:2357)
        at java.base/java.util.concurrent.CompletableFuture$MinimalStage.whenComplete(CompletableFuture.java:2948)
        at io.quarkus.scheduler.common.runtime.DefaultInvoker.invoke(DefaultInvoker.java:24)
        at io.quarkus.scheduler.common.runtime.StatusEmitterInvoker.invoke(StatusEmitterInvoker.java:35)
        at io.quarkus.scheduler.runtime.SimpleScheduler$ScheduledTask.doInvoke(SimpleScheduler.java:443)
        at io.quarkus.scheduler.runtime.SimpleScheduler$ScheduledTask$2.call(SimpleScheduler.java:425)
        at io.quarkus.scheduler.runtime.SimpleScheduler$ScheduledTask$2.call(SimpleScheduler.java:422)
        at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$0(ContextImpl.java:177)
        at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:276)
        at io.vertx.core.impl.ContextImpl.lambda$internalExecuteBlocking$2(ContextImpl.java:209)
        at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:587)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.NoClassDefFoundError: io/opentelemetry/semconv/HttpAttributes
        at com.microsoft.kiota.http.OkHttpRequestAdapter.getRequestFromRequestInformation(OkHttpRequestAdapter.java:878)
        at com.microsoft.kiota.http.OkHttpRequestAdapter.getHttpResponseMessage(OkHttpRequestAdapter.java:719)
        at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:280)
        at com.microsoft.graph.groups.item.members.MembersRequestBuilder.get(MembersRequestBuilder.java:146)
        at my.corp.directory.DirectoryReader.updateUsers(DirectoryReader.java:163)
        at my.corp.directory.DirectoryReader_ClientProxy.updateUsers(Unknown Source)
        at my.corp.directory.DirectoryReader_ScheduledInvoker_updateUsers_fa922a3d5993a039372a4e6b393ec8711b9c46e0.invokeBean(Unknown Source)
        ... 15 more
Caused by: java.lang.ClassNotFoundException: io.opentelemetry.semconv.HttpAttributes
        ... 22 more

It runs inside Quarkus in a Scheduler. Do you have any hints on how I could fix this?

Maybe it's related to this change? a191db9

@github-project-automation github-project-automation bot moved this to Todo 📃 in Kiota Apr 18, 2024
@baywet
Copy link
Member

baywet commented Apr 18, 2024

Hi @yvespp
Thanks for using the Microsoft Graph SDK and for reaching out.
When looking at the diff one thing strikes me: the addition of this line in dependencies.gradle.
implementation 'io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.24.0-alpha'

Out of curiosity, if you add that dependency to your project, does it solve the issue?

@yvespp
Copy link
Author

yvespp commented Apr 18, 2024

Hi @baywet
Adding the dependency doesn't change anything.
A colleague found out that Quarkus currently uses 1.21.0-alpha which isn't compatible with 1.21.0-alpha because of open-telemetry/semantic-conventions-java#45
If we add

<dependency>
    <groupId>io.opentelemetry.semconv</groupId>
    <artifactId>opentelemetry-semconv</artifactId>
    <version>1.24.0-alpha</version>
</dependency>

as a dependency we get a ClassNotFoundException in the QuarkusClassLoader...

I think we just have to wait until Quarkus is up to date and I will close this...

@baywet
Copy link
Member

baywet commented Apr 18, 2024

Thanks for sharing your findings.
CC @andreaTP since he worked a lot on integrating kiota with quarkus natively

@andreaTP
Copy link
Contributor

Which version of Quarkus are you using?
And the version of kiota-abstractions too, aligning them to something cross-compatible should do the trick.

@yvespp
Copy link
Author

yvespp commented Apr 18, 2024

Currently we are using Quarkus 3.7.3. mvn dependency:tree sais where using microsoft-kiota-abstractions:jar:1.1.2:

[INFO] +- com.microsoft.graph:microsoft-graph:jar:6.6.0:compile
[INFO] |  +- com.microsoft.graph:microsoft-graph-core:jar:3.1.7:compile
[INFO] |  |  +- com.microsoft.kiota:microsoft-kiota-abstractions:jar:1.1.2:compile
[INFO] |  |  |  \- io.github.std-uritemplate:std-uritemplate:jar:0.0.55:runtime
[INFO] |  |  \- com.google.code.gson:gson:jar:2.10.1:runtime
[INFO] |  +- com.squareup.okhttp3:okhttp:jar:4.12.0:compile
[INFO] |  |  +- com.squareup.okio:okio:jar:3.6.0:compile
[INFO] |  |  |  \- com.squareup.okio:okio-jvm:jar:3.6.0:compile
[INFO] |  |  |     \- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.9.22:compile
[INFO] |  |  \- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.9.22:compile
[INFO] |  |     \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.9.22:compile
[INFO] |  +- jakarta.annotation:jakarta.annotation-api:jar:2.1.1:compile
[INFO] |  +- com.microsoft.kiota:microsoft-kiota-authentication-azure:jar:1.1.4:runtime
[INFO] |  +- com.microsoft.kiota:microsoft-kiota-http-okHttp:jar:1.1.4:runtime
[INFO] |  |  +- io.opentelemetry.semconv:opentelemetry-semconv:jar:1.21.0-alpha:compile
[INFO] |  |  \- io.opentelemetry.semconv:opentelemetry-semconv-incubating:jar:1.24.0-alpha:runtime
[INFO] |  +- com.microsoft.kiota:microsoft-kiota-serialization-json:jar:1.1.4:runtime
[INFO] |  +- com.microsoft.kiota:microsoft-kiota-serialization-text:jar:1.1.4:runtime
[INFO] |  +- com.microsoft.kiota:microsoft-kiota-serialization-form:jar:1.1.4:runtime
[INFO] |  \- com.microsoft.kiota:microsoft-kiota-serialization-multipart:jar:1.1.4:runtime

I tried updating microsoft-kiota-abstractions to 1.1.4 but is still throws the same NoClassDefFoundError...

@andreaTP
Copy link
Contributor

I think that this bug report is valid, and they are pointing it out in the Readme:

NOTE: This artifact has the -alpha and comes with no compatibility guarantees. Libraries can use this for testing, but should make copies of the attributes to avoid possible runtime errors from version conflicts.

We should remove those alpha dependencies as they are going to cause all kinds of classpath incompatibilities.

@andreaTP
Copy link
Contributor

@yvespp or @baywet can you re-open this issue?

@yvespp yvespp reopened this Apr 18, 2024
@github-project-automation github-project-automation bot moved this from Done ✔️ to In Progress 🚧 in Kiota Apr 18, 2024
@baywet baywet added bug Something isn't working and removed question Needs: Attention 👋 labels Apr 19, 2024
@baywet baywet added this to the Kiota v1.14 milestone Apr 19, 2024
@github-project-automation github-project-automation bot moved this from In Progress 🚧 to Done ✔️ in Kiota Apr 19, 2024
@yvespp
Copy link
Author

yvespp commented Apr 24, 2024

Thanks for fixing it so fast!
Now msgraph-sdk-java v6.6.0 works with microsoft-kiota-http-okHttp 1.1.6 in our Quarkus App.

@andreaTP
Copy link
Contributor

Thanks for the feedback 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants