question

Awadh Pandey avatar image
Awadh Pandey asked Awadh Pandey answered

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?

getting started
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image
Tyler Liu answered Tyler Liu commented

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.

1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

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

0 Likes 0 ·
Tyler Liu avatar image
Tyler Liu answered Tyler Liu commented

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

1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image
Tyler Liu answered

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

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Awadh Pandey avatar image
Awadh Pandey answered

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.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys