EventStore / EventStoreDB-Client-Java

Official Asynchronous Java 8+ Client Library for EventStoreDB 20.6+
https://eventstore.com
Apache License 2.0
63 stars 19 forks source link

java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/json/JsonMapper #216

Closed DmitriyLiakhovJava closed 1 year ago

DmitriyLiakhovJava commented 1 year ago

Hi, we had some problem. Our project have very low version of Jackson, and we can't upgrade it.

When we trying to create new 'EventDate' using 'EventDataBuilder' we have new exception, because in this builder hardcoded 'JsonMapper'.

Please, can you take out Jackson.

We have a suggestion to improve this problem:

https://github.com/EventStore/EventStoreDB-Client-Java/pull/215


Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/json/JsonMapper
    at com.eventstore.dbclient.EventDataBuilder.<clinit>(EventDataBuilder.java:12)
    at com.eventstore.dbclient.EventData.builderAsBinary(EventData.java:99)
    at com.eventstore.dbclient.EventData.builderAsBinary(EventData.java:88)

    at io.reactivex.rxjava3.internal.operators.mixed.ObservableConcatMapCompletable$ConcatMapCompletableObserver.drain(ObservableConcatMapCompletable.java:142)
    at io.reactivex.rxjava3.internal.operators.mixed.ConcatMapXMainObserver.onNext(ConcatMapXMainObserver.java:95)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableDoOnEach$DoOnEachObserver.onNext(ObservableDoOnEach.java:101)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onNext(ObservableSubscribeOn.java:58)
    at io.reactivex.rxjava3.internal.observers.DeferredScalarDisposable.complete(DeferredScalarDisposable.java:82)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableFromCallable.subscribeActual(ObservableFromCallable.java:56)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13173)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    at io.reactivex.rxjava3.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
    ... 8 more
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.json.JsonMapper
    at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
    ... 21 more```
YoEight commented 1 year ago

Hey @DmitriyLiakhovJava,

Could you share what JDK version you are using?

DmitriyLiakhovJava commented 1 year ago

We are using OpenJDK 1.8.202 and in our project we have 'com.fasterxml.jackson' - 2.8.7.

YoEight commented 1 year ago

I think it's reasonable to get rid of the JsonMapper in the EventDataBuilder type. It's actually something I had to do. There is another place where this could also happen and it's when you want to read a stream metadata, using getStreamMetadata method. Would you be using such method in a near future?

DmitriyLiakhovJava commented 1 year ago

Great! Won't be using in a near future 'getStreamMetadata'. 😊

DmitriyLiakhovJava commented 1 year ago

Сan i know when the fix will be published?

YoEight commented 1 year ago

I'll have the PR ready today, after that it depends on how fast it got reviewed.

YoEight commented 1 year ago

@DmitriyLiakhovJava I just cut release 4.1.1. It should be available on Maven Central in 3-6 hours.