auth0-java: java.lang.NoSuchMethodError: 'okhttp3.RequestBody okhttp3.RequestBody.create(byte[], okhttp3.MediaType)'
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:
AuthAPI authAPI = new AuthAPI("{YOUR_DOMAIN}", "{YOUR_CLIENT_ID}", "{YOUR_CLIENT_SECRET}");
AuthRequest authRequest = authAPI.requestToken("https://{YOUR_DOMAIN}/api/v2/");
TokenHolder holder = authRequest.execute();
ManagementAPI mgmt = new ManagementAPI("{YOUR_DOMAIN}", holder.getAccessToken());
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:
Caused by: java.lang.NoSuchMethodError: 'okhttp3.RequestBody okhttp3.RequestBody.create(byte[], okhttp3.MediaType)'
at com.auth0.net.CustomRequest.createRequestBody(CustomRequest.java:50)
at com.auth0.net.ExtendedBaseRequest.createRequest(ExtendedBaseRequest.java:49)
at com.auth0.net.BaseRequest.execute(BaseRequest.java:29)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 14
- Comments: 31 (14 by maintainers)
Commits related to this issue
- 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.NoSuchMe... — committed to gciavarrini/parodos by gciavarrini a year ago
- Fix OkHttp dependency issue `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 depdendenc... — committed to gciavarrini/parodos by gciavarrini a year ago
- Fix OkHttp dependency issue `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 depdendenc... — committed to parodos-dev/parodos by gciavarrini a year ago
- Fix OkHttp dependency issue `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 depdendenc... — committed to RichardW98/parodos by gciavarrini a year ago
- Fix OkHttp dependency issue `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 depdendenc... — committed to parodos-dev/parodos by gciavarrini a year ago
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!
It seems to fix the problem! I will test it more thoroughly in the next days but for now this basic call has passed.
Now my pom.xml looks like this:
Not pretty but at least it works.
Identical issue, have reverted to
1.24.0
until further updates.Resolved dependency tree of
1.24.0
looks like:Resolved dependency tree of
1.25.0
looks like:In my case it is
okhttp3
version resolution which causes this (I think) as the error seems to relate to the method deprecated inokhttp3 version 4
, iecom.squareup.okhttp3:okhttp:4.9.0 -> 3.14.9
But interestingly different versions of
okhttp3
are required withincom.auth0:auth0:1.25.0
itself:com.squareup.okhttp3:okhttp:4.9.0
com.squareup.okhttp3:logging-interceptor:3.14.9
that depends oncom.squareup.okhttp3:okhttp:3.14.9
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.
I am not using spring, and I don’t see why this is necessary at all.
Was able to reproduce in https://github.com/ivarprudnikov/test-auth0-java-dependency with a
build.gradle
file:There are Github actions enabled and it tries to run the app which generates the failure we talk about here.
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.
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.