HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support
I would expect the library to work within a native-image by default.
Actual behavior
My program fails as soon as it hits the hivemq-mqtt-client.
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:291)
at java.lang.Class.ensureInitialized(DynamicHub.java:515)
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:236)
at java.lang.Class.ensureInitialized(DynamicHub.java:515)
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:236)
at java.lang.Class.ensureInitialized(DynamicHub.java:515)
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:236)
at java.lang.Class.ensureInitialized(DynamicHub.java:515)
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:236)
at java.lang.Class.ensureInitialized(DynamicHub.java:515)
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:236)
at com.hivemq.client.internal.mqtt.handler.publish.outgoing.MqttOutgoingQosHandler.<init>(MqttOutgoingQosHandler.java:92)
at com.hivemq.client.internal.mqtt.handler.publish.outgoing.MqttOutgoingQosHandler_Factory.newInstance(MqttOutgoingQosHandler_Factory.java:34)
at com.hivemq.client.internal.mqtt.handler.publish.outgoing.MqttOutgoingQosHandler_Factory.get(MqttOutgoingQosHandler_Factory.java:25)
at com.hivemq.client.internal.mqtt.handler.publish.outgoing.MqttOutgoingQosHandler_Factory.get(MqttOutgoingQosHandler_Factory.java:8)
at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at com.hivemq.client.internal.mqtt.handler.MqttSession_Factory.get(MqttSession_Factory.java:35)
at com.hivemq.client.internal.mqtt.handler.MqttSession_Factory.get(MqttSession_Factory.java:10)
at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at com.hivemq.client.internal.mqtt.handler.connect.MqttConnectHandler_Factory.get(MqttConnectHandler_Factory.java:43)
at com.hivemq.client.internal.mqtt.handler.connect.MqttConnectHandler_Factory.get(MqttConnectHandler_Factory.java:11)
at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at com.hivemq.client.internal.mqtt.handler.MqttChannelInitializer_Factory.get(MqttChannelInitializer_Factory.java:60)
at com.hivemq.client.internal.mqtt.handler.MqttChannelInitializer_Factory.get(MqttChannelInitializer_Factory.java:17)
at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at com.hivemq.client.internal.mqtt.ioc.DaggerSingletonComponent$ClientComponentImpl$ConnectionComponentImpl.bootstrap(DaggerSingletonComponent.java:440)
at com.hivemq.client.internal.mqtt.handler.connect.MqttConnAckSingle.connect(MqttConnAckSingle.java:86)
at com.hivemq.client.internal.mqtt.handler.connect.MqttConnAckSingle.subscribeActual(MqttConnAckSingle.java:68)
at io.reactivex.Single.subscribe(Single.java:3666)
at io.reactivex.Single.blockingGet(Single.java:2869)
at com.hivemq.client.internal.mqtt.MqttBlockingClient.connect(MqttBlockingClient.java:99)
at com.hivemq.client.internal.mqtt.mqtt3.Mqtt3BlockingClientView.connect(Mqtt3BlockingClientView.java:77)
at com.hivemq.client.internal.mqtt.mqtt3.Mqtt3BlockingClientView.connect(Mqtt3BlockingClientView.java:70)
at de.smartsquare.kortance.mqtt.Mqtt3ClientWrapper.connect(Mqtt3ClientWrapper.kt:8)
at de.smartsquare.kortance.scenarios.spike.SpikeCommand.call(SpikeCommand.kt:35)
at de.smartsquare.kortance.scenarios.spike.SpikeCommand.call(SpikeCommand.kt:11)
at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
at picocli.CommandLine.access$1200(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
at picocli.CommandLine.execute(CommandLine.java:2058)
at de.smartsquare.kortance.KortanceKt.main(Kortance.kt:26)
Caused by: java.lang.RuntimeException: java.lang.NoSuchFieldException: consumerIndex
at org.jctools.util.UnsafeAccess.fieldOffset(UnsafeAccess.java:91)
at org.jctools.queues.BaseSpscLinkedArrayQueueConsumerField.<clinit>(BaseSpscLinkedArrayQueue.java:47)
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:351)
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:271)
... 43 more
Caused by: java.lang.NoSuchFieldException: consumerIndex
at java.lang.Class.getDeclaredField(DynamicHub.java:2070)
at org.jctools.util.UnsafeAccess.fieldOffset(UnsafeAccess.java:87)
... 46 more
Hi @deen13 - since it's been 2+ years, I'll close this issue out soon. If you have any updates or this is still an issue for you, please let us know. Please also see #467 which is linked into this issue.
Expected behavior
I would expect the library to work within a native-image by default.
Actual behavior
My program fails as soon as it hits the hivemq-mqtt-client.
Reproducer
Repository: https://github.com/SmartsquareGmbH/kortance/tree/develop
Details