Skip to main content
The First Step
Feb 11, 2022 2:58 AM UTC
Question

Ringout example throws exception java.lang.NoSuchMethodError

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?

    6 replies

    Employee
    Feb 11, 2022 4:29 PM UTC

    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.

    Employee
    Feb 11, 2022 4:31 PM UTC

    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

    Employee
    Feb 11, 2022 8:46 PM UTC

    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

    Employee
    Feb 11, 2022 8:47 PM UTC
    Employee
    Feb 11, 2022 8:48 PM UTC

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

    awadhThe First StepAuthor
    The First Step
    Feb 12, 2022 1:14 AM UTC

    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.