meilisearch / meilisearch/meilisearch-java

NoClassDefFoundError: okhttp3/MediaType, after upgrading to 0.18.0

Open
#923 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
245
Forks
152
PR merge metrics
No merged PRs in 30d

Description

From 0.17.1 onwards the okhttp version was changed to 5.x again and the same issue NoClassDefFoundError came up again, so I had to manually exclude okhttp and import the 4.x version of okhttp.
Or change version to 0.17.0

    <dependency>
        <groupId>com.meilisearch.sdk</groupId>
        <artifactId>meilisearch-java</artifactId>
        <version>0.18.0</version>
        <exclusions>
            <exclusion>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.squareup.okhttp3</groupId>
        <artifactId>okhttp</artifactId>
        <version>4.12.0</version>
    </dependency>

Originally posted by @zhuyisuzhi in #893

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the NoClassDefFoundError with com.meilisearch.sdk:meilisearch-java:0.18.0 and inspect its resolved okhttp dependency, comparing it with 0.17.0 and the reported okhttp 4.12.0 workaround. Done means a normal 0.18.0 dependency can run without manually excluding okhttp or adding a replacement version.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.