What Can I Do When Error Message "okhttp3.RequestBody.create(java.lang.String,okhttp3.MediaType)" Is Displayed for Java SDK?
Symptom
Error message "okhttp3.RequestBody.create(java.lang.String,okhttp3.MediaType)" is reported for Java SDK.
Cause
Spring Boot specifies the version of third-party dependencies. For details, see Spring Boot Managed Dependency Coordinates. When the OBS SDK is introduced to a Spring Boot framework, the version of OkHttp3 (dependency specified by the SDK) will be changed from 4.8.0 to 3.14.9. As a result, the specified method cannot be obtained. To avoid this issue, you can use the bundle SDK that integrates third-party dependencies, or explicitly reference OkHttp3 4.8.0 in your project.
Solution
Refer to Resolving Dependency Missing and Dependency Conflict to check whether the third-party dependency version is correctly referenced. Alternatively, use the following code to import the bundle SDK to replace the original one.
<dependency> <groupId>com.huaweicloud</groupId> <artifactId>esdk-obs-java-bundle</artifactId> <version>[3.21.8,)</version> </dependency>
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot