typesense-java icon indicating copy to clipboard operation
typesense-java copied to clipboard

Missing dependency or library when including typsense-java 0.9.0

Open lm-aols opened this issue 5 months ago • 0 comments

Description

When trying to instantiate a Typesense Client, I get a NoClassDefFoundError

Steps to reproduce

I have added the following to my pom.xml:

<dependency>
            <groupId>org.typesense</groupId>
            <artifactId>typesense-java</artifactId>
            <version>0.9.0</version>
</dependency>

When I try to instantiate a Client, I get the following stack trace (Edited for anonymity)

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.typesense.api.ApiCall
        at org.typesense.api.Client.<init>(Client.java:28) ~[typesense-java-0.9.0.jar:?]
        at TypeSenseClient.getClient(DefaultRaptorTypeSenseClient.java:132) ~[classes/:?]
        at TypeSenseClient.collectionExists(DefaultRaptorTypeSenseClient.java:40) ~[classes/:?]
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: okhttp3/MediaType
        at org.typesense.api.ApiCall.<clinit>(ApiCall.java:38) ~[typesense-java-0.9.0.jar:?]
        at org.typesense.api.Client.<init>(Client.java:28) ~[typesense-java-0.9.0.jar:?]

Expected Behavior

I expect the dependency for typesense-java to include a dependency for okhttp3 which the library uses internally.

Actual Behavior

The okhttp3 library seems to be missing, and therefore the code cannot run

Metadata

Typesense Version: 27.0

OS: Fedora 40 - Linux

lm-aols avatar Sep 23 '24 12:09 lm-aols