-
Notifications
You must be signed in to change notification settings - Fork 131
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
java.lang.NoSuchMethodError: 'okhttp3.RequestBody okhttp3.RequestBody.create(byte[], okhttp3.MediaType)' #324
Comments
Identical issue, have reverted to Resolved dependency tree of
Resolved dependency tree of
In my case it is But interestingly different versions of
|
Thanks for the detailed info and dependency tree reports. I'm back from holiday this week; will take a look and hopefully get a fix out soon. |
I have #325 which is needed (just a bad miss on my part 😞), but I'm actually not able to reproduce this exact issue. If anyone has a small test app that reproduces this issue and could share it in a gist or a simple github repo, that would be great and I can then verify that the fix will indeed address the specific error raised here. Thanks all, apologies for this mistake! |
Was able to reproduce in https://github.com/ivarprudnikov/test-auth0-java-dependency with a
There are Github actions enabled and it tries to run the app which generates the failure we talk about here. |
Fantastic, thank you @ivarprudnikov! I'm able to reproduce the issue with your example. I suspect it's the spring dependency management plugin using its bom for okhttp v3, overriding auth0-java's dependency on v4, but need to investigate more. |
If I remove the Spring dependency management plugin ( As noted above, the specific issue is the change that replaced the (now deprecated as of version 4) call to I've not worked extensively with the Spring dependency management plugin, but I have had to find some workarounds in the past to override dependency versions using an extension property, e.g. something like: ext {
set 'okhttp3.version', '4.9.0'
} Perhaps someone with more knowledge of that dependency plugin may be aware of another workaround. |
It could be fixed by adding strictly version into the dependencies
Or adding the BOM into the dependencyManagement
|
Having the same issue... please fix asap! |
Hey guys, any updates on this? Reverting down to 1.24 and trying to do a user update throws a:
|
@zhGio it does not get fix managing the dependencies as described earlier? The problem is a transitive dependency from Spring. Another solution could be to manage manually transitive dependencies from Spring: |
Well unfortunately I'm using maven and not gradle and not sure how to apply the changes above mentioned |
Ah alright, simply overrode the version in my pom.xml Anyway, after the version upgrade I can successfully send the request through the auth0 SDK but I'm still getting the same message as above. Here's my full code snippet:
results in:
UPDATE: I figured out what went wrong but I'm dumbfounded as to why this was implemented this way, and going to leave the comment here so it might be useful for someone else. So I considered the 'additional properties not allowed:' message and I removed them from the
Note that I had to save the userId and then set the userId to null before sending the update request so that the request isn't bounced again (note that the 'Additional properties' message also included the user_id. |
in android studio I did what @jsalinaspolo said above but still saw it red and then after 'invalidate cashs/restart' got it worked finally |
@zhGio I think the 400 error is unrelated to the OkHttp version, as it's an error being returned from the management API after making the request. If that is something specific to this SDK (e.g., a similar request done in a REST client is successful), please open up a new issue here for that. |
As noted above, if using spring dependency management, the solution is to add the okhttp v4 to the Spring BOM. We will update the README to include this information. |
I am not using spring, and I don't see why this is necessary at all. |
I don't know why this is closed since it's not fixed. What can we do to avoid this exception? |
@majugurci I am not familiar with Quarkys, but does it use an old OkHttp version? If Quarkus or any other framework uses an old version of OkHttp and makes it a transitive dependency, it will need to be managed in the dependency management tool you use |
Quarkus uses maven for dependency management. I have tried to override okhttp dependency like here but then it gives me another error:
After looking at effective pom i see 3 mentions of okhttp:
I have tried to also update logging-interceptor but then it throws this Exception:
If i try to update grpc-okhttp nothing relevant happens. |
I use Quarkus as well, and I just ran mvn dependeny:tree on my project. The only dependency using okhttp3 is auth0: It's not fixed, I will stay on 1.24.0 and move away from auth0 as fast as possible. |
@MarcusBiel could you share the dependency tree using |
After running mvn dependency:tree with Auth0 version 1.27.0 this is what I got:
|
The issue is while using Quarkus dependency management, similar to what was describe while using Spring dependency management. To be able to reproduce the different scenarios, I created this sample repository Adding it to dependencyManagement should enforce version
|
I have tried it and now it really does show version 4.9.0 in dependency tree.
But now when calling
it gives me the following error:
Has anything changed about this call from version 1.24.0? EDIT:
|
Reopening based on above, thanks for providing the sample to reproduce, we'll follow up here with additional info once we reproduce and see what the solution may be. |
@majugurci I think that error is similar, but related to <dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>2.10.0</version>
</dependency> |
It seems to fix the problem! Now my pom.xml looks like this:
Not pretty but at least it works. |
The majority of these issues should be resolved in |
Just an update, I have updated Auth0 to the latest version (currently 1.30.0) and these changes are not necessary in the pom.xml anymore. |
…d to make requests to the Auth0 Authentication and Management APIs. When using Spring's depdendency management, `java.lang.NoSuchMethodError` exception is thrown when making requests, related to Spring's dependency management using OkHttp 3. See https://github.com/auth0/auth0-java/pull/342/files and auth0/auth0-java#324 Signed-off-by: Gloria Ciavarrini <gciavarrini@redhat.com>
`auth0-java` library uses `OkHttp` version 4 as the networking client used to make requests to the Auth0 Authentication and Management APIs. When using Spring's depdendency management, `java.lang.NoSuchMethodError` exception is thrown when making requests, related to Spring's dependency management using OkHttp 3. See https://github.com/auth0/auth0-java/pull/342/files and auth0/auth0-java#324 Signed-off-by: Gloria Ciavarrini <gciavarrini@redhat.com>
`auth0-java` library uses `OkHttp` version 4 as the networking client used to make requests to the Auth0 Authentication and Management APIs. When using Spring's depdendency management, `java.lang.NoSuchMethodError` exception is thrown when making requests, related to Spring's dependency management using OkHttp 3. See https://github.com/auth0/auth0-java/pull/342/files and auth0/auth0-java#324 Signed-off-by: Gloria Ciavarrini <gciavarrini@redhat.com>
`auth0-java` library uses `OkHttp` version 4 as the networking client used to make requests to the Auth0 Authentication and Management APIs. When using Spring's depdendency management, `java.lang.NoSuchMethodError` exception is thrown when making requests, related to Spring's dependency management using OkHttp 3. See https://github.com/auth0/auth0-java/pull/342/files and auth0/auth0-java#324 Signed-off-by: Gloria Ciavarrini <gciavarrini@redhat.com>
`auth0-java` library uses `OkHttp` version 4 as the networking client used to make requests to the Auth0 Authentication and Management APIs. When using Spring's depdendency management, `java.lang.NoSuchMethodError` exception is thrown when making requests, related to Spring's dependency management using OkHttp 3. See https://github.com/auth0/auth0-java/pull/342/files and auth0/auth0-java#324 Signed-off-by: Gloria Ciavarrini <gciavarrini@redhat.com>
我也遇到了相同的问题,在springboot:2.6.14中引入了okhttp4.9.2,编译时未见有问题,运行时调用则报错,修改为官方推荐的3.14.9后问题解决,solved |
this is right help me so much thank you |
Hello,
after upgrading to the version 1.25.0 (from 1.24.0) i get the error in the title when getting TokenHolder.
My code looks the same as in your docs:
The problem is this line: TokenHolder holder = authRequest.execute();
In previous versions everything worked great but since update to 1.25.0 it throws the following error:
The text was updated successfully, but these errors were encountered: