Repository navigation
Caused by: java.lang.NoSuchFieldError: okhttp3/RequestBody.Companion #515
Description
Activity
@jacksierkstra This is a common issue when the OkHTTP version conflicts from the Dapr SDK and any of your other dependencies. You can fix this by changing the springboot version to one that uses a compatible OkHTTP version or force a compatible okHTTP version in your project by adding the following dependency:
<dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp</artifactId> <version>4.9.0</version> </dependency>
Reacted by Marta Sojková- addedquestionFurther information is requestedFurther information is requestedand removedkind/bugSomething isn't workingSomething isn't working
on Mar 16, 2021 Ok, thank you.
- added a commit that references this issue
on Jun 27, 2021 I'm using Quarkus and get
FINE Unable to find OkHttpChannelProvider: java.lang.ClassNotFoundException: io.grpc.okhttp.OkHttpChannelProviderI tried adding the
okhttpdependency but the problem continues.@MotaOcimar have you also added the quarkus grpc dependency? After that I was able to use the dapr sdk from Quarkus native image.
@MotaOcimar have you also added the quarkus grpc dependency? After that I was able to use the dapr sdk from Quarkus native image.
I added the
quarkus-grpcdependecy and the application don't even build due toType io.quarkus.arc.deployment.RecorderBeanInitializedBuildItem not present.Then I added the
quarkus-arc-deploymentdependency and gotA required class was missing while executing io.quarkus.platform:quarkus-maven-plugin:2.2.2.Final:build: io/quarkus/arc/AsyncObserverExceptionHandlerSo I tried to add the ArC Runtime and/or Quarkus ArC Runtime dependecies, but with no success.
I don't really know the difference between these last two dependencies, but each one led me to a different error, as did adding the two.I also tried the Quarkus Dapr Runtime but got
java.lang.NoSuchFieldError: CompanionReacted by Govind Kamtamneni+1 as @MotaOcimar - Tried to add
okhttpas described in #515 (comment) and the dependency, as well asquarkus-grpc, resulting the same error:Caused by: java.lang.NoSuchFieldError: Companion at io.dapr.client.DaprHttp.<clinit>(DaprHttp.java:129)Resolved it with the following version combination:
<dapr.version>1.5.0</dapr.version> <okhttp.version>4.10.0</okhttp.version>Resolved it with the following version combination:
<dapr.version>1.5.0</dapr.version> <okhttp.version>4.10.0</okhttp.version>It doesn't work for me 😢
I continue with errorUnable to find OkHttpChannelProvider: java.lang.ClassNotFoundException: io.grpc.okhttp.OkHttpChannelProviderIs there any workaround for this problem?
I'm also trying with Spring instead of Quarkus and I'm getting stuck with it 😭
Tried different combinations of versions but no luck
With Dapr version 1.7.1 and okhttp version 4.9.0 I get
java.lang.NoClassDefFoundError: Could not initialize class io.dapr.client.DaprHttp
Expected Behavior
Being able to construct a
DaprClientby usingnew DaprClientBuilder().build().Actual Behavior
Instead of being able to construct a new instance, the application crashes with the following stacktrace:
Steps to Reproduce the Problem
I created a very small Spring Boot application that creates a
DaprClientupon starting up as a bean.The application has the following (relevant) dependencies:
And I added the following configuration:
When I start my application, it crashes. Tried with both dapr version
1.0.0and1.1.0-SNAPSHOT.Release Note
RELEASE NOTE: FIX Bug in construction of HTTP client.