Resolving Dependency Missing or Conflicts (SDK for Java)
Dependency missing and dependency conflict are commonly encountered in Java development. When using the common SDK for Java, if the error message "ClassNotFoundException" or "NoClassDefFoundError" is reported during application compilation and running, check whether this is a problem related to dependencies. If yes, perform the following steps to locate and rectify the fault.
Background Knowledge
The SDK for Java comes in two versions: bundle and standard. The comparison between the two versions is as follows:
| Dimension | Standard | Bundle | ||||
|---|---|---|---|---|---|---|
| Application scenario | The standard version is small in size and suitable for space-sensitive scenarios. | This version is applicable to space-insensitive scenarios where dependency conflicts are difficult to resolve. | ||||
| Source code | The source code of the bundle version is the same as that of the standard version. | |||||
| Space used | Small. It contains only the SDK code and does not have built-in third-party dependencies. | Large. In the bundle version, all third-party dependencies are packaged and redirected to the package, without depending on external third-party packages. This prevents problems caused by dependency conflicts. | ||||
| Maven configuration |
|
| ||||
Solution
Dependency Missing
The following table lists the third-party components (including their versions) that the latest SDK depends on.
| Dependency | Version | Description |
|---|---|---|
| okhttp | 4.12.0 | Used to send HTTP requests. |
| okio | 3.8.0 | Component of OkHttp |
| jackson-core | 2.15.4 | Used to construct and parse JSON files. |
| jackson-databind | 2.15.4 | Component of jackson-core |
| jackson-annotations | 2.15.4 | Component of jackson-core |
Dependency Conflict
If your project has multiple versions of OBS Java SDK packages or third-party dependencies, dependency conflicts may occur. If there are SDKs of earlier versions, delete them and use the latest version. If there are multiple versions of third-party dependencies, replace the conflicting ones with the versions required by the SDK.
What is your overall rating for this page?
Thank 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