Skip to main content

As I'm going through the ringout tutorials and get java.lang.NoSuchMethodError: 'okhttp3.RequestBody okhttp3.RequestBody.create(java.lang.String, okhttp3.MediaType) exception

I am running the code in Spring Boot with Java 15.0.2

<dependency>
<groupId>com.ringcentral</groupId>
<artifactId>ringcentral</artifactId>
<version>2.6.0</version>
</dependency>

It seems that this error is related to function okhttp3.RequestBody okhttp3.RequestBody.create(java.lang.String, okhttp3.MediaType) , but I am not making any such call. Perhaps SDK is calling this function internally. How should I resolve it?

Yes I can see the function call in the source code of the SDK https://github.com/ringcentral/ringcentral-java/blob/master/src/main/java/com/ringcentral/RestClient.java#L186-L190

But all the test cases still pass. I am thinking about how can I reproduce the issue.


I think maybe it has something to do with Java 15. I have created a ticket to track it: https://github.com/ringcentral/ringcentral-java/issues/30


We tested both Java 11 and Java 17, both are LTS versions. We cannot reproduce the issue.

It is appreciated if you could create a simple project to reproduce it and share it with me. Thanks


Ref: https://github.com/ringcentral/ringcentral-java/issues/30


It is likely that you are using a newer version of okhttp. The SDK is tested against okhttp 4.9.1


Hi Tyler,
Thank you for your time and response.

My okhttp is downloaded as part of Spring boot 2.4.11 and it is <okhttp3.version>3.14.9</okhttp3.version>
So it is not a newer version than okhttp 4.9.1.

Let me create a simple java project and I will upload the link.


Reply