hazelcast / quarkus-hazelcast-client

Quarkus Hazelcast Client Extension
44 stars 10 forks source link

java.lang.NoClassDefFoundError: com/hazelcast/com/fasterxml/jackson/core/JsonFactory #384

Closed vladykin closed 1 year ago

vladykin commented 1 year ago

Describe the bug Attempted to bump Hazelcast dependency version in our Quarkus 3.2-based app from 5.2.2 to 5.3.4. Started getting NoClassDefFoundError: com/hazelcast/com/fasterxml/jackson/core/JsonFactory in tests annotated with @QuarkusTest.

quarkus-hazelcast-client 4.0.0 refers to this class, but apparently it's not there in the latest Hazelcast.

[ERROR] Errors: 
[ERROR]   MyQuarkusAppTest » Runtime java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
    [error]: Build step io.quarkus.hazelcast.client.deployment.HazelcastClientProcessor#registerServiceProviders threw an exception: java.lang.NoClassDefFoundError: com/hazelcast/com/fasterxml/jackson/core/JsonFactory
    at io.quarkus.hazelcast.client.deployment.HazelcastClientProcessor.registerServiceProviders(HazelcastClientProcessor.java:97)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:858)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
    at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
    at java.base/java.lang.Thread.run(Thread.java:833)
    at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.lang.ClassNotFoundException: com.hazelcast.com.fasterxml.jackson.core.JsonFactory
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
    at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:516)
    at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
    ... 12 more
rkraneis commented 1 year ago

Unfortunately, this happens in the quarkus deployment, so not much a mere user can do here ... It builds (and tests) fine with the following patch:

diff --git a/deployment/src/main/java/io/quarkus/hazelcast/client/deployment/HazelcastClientProcessor.java b/deployment/src/main/java/io/quarkus/hazelcast/client/deployment/HazelcastClientProcessor.java
index d9bce4b..176820e 100644
--- a/deployment/src/main/java/io/quarkus/hazelcast/client/deployment/HazelcastClientProcessor.java
+++ b/deployment/src/main/java/io/quarkus/hazelcast/client/deployment/HazelcastClientProcessor.java
@@ -27,7 +27,7 @@ import com.hazelcast.client.impl.spi.ClientProxyFactory;
 import com.hazelcast.client.util.RandomLB;
 import com.hazelcast.cluster.MembershipListener;
 import com.hazelcast.collection.ItemListener;
-import com.hazelcast.com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonFactory;
 import com.hazelcast.config.replacer.EncryptionReplacer;
 import com.hazelcast.config.replacer.PropertyReplacer;
 import com.hazelcast.config.replacer.spi.ConfigReplacer;
diff --git a/pom.xml b/pom.xml
index b45ccee..2fc2fb0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,7 +44,7 @@

     <properties>
         <quarkus.version>3.2.3.Final</quarkus.version>
-        <hazelcast.version>5.2.4</hazelcast.version>
+        <hazelcast.version>5.3.5</hazelcast.version>
         <jcache.version>1.1.1</jcache.version>
         <affinity.version>3.23.3</affinity.version>

@@ -280,4 +280,4 @@
             </build>
         </profile>
     </profiles>
-</project>
\ No newline at end of file
+</project>

So maybe a fix could be made available soon(ish)?

vladykin commented 1 year ago

Thank you for the fix! Where will the new release of quarkus-hazelcast-client be available?

rkraneis commented 4 months ago

When can we expect a release with this fix? We are unable to use newer versions of Hazelcast Client without it unless we build quarkus-hazelcast-client from source ...