diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java index 77cdf9fbd5ad6..128cc21e640e4 100644 --- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java +++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java @@ -62,6 +62,7 @@ import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveHierarchyBuildItem; +import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import io.quarkus.deployment.pkg.NativeConfig; import io.quarkus.kafka.client.runtime.KafkaBindingConverter; @@ -395,6 +396,15 @@ UnremovableBeanBuildItem ensureJsonParserAvailable() { "javax.json.bind.Jsonb"); } + @BuildStep + public void registerRuntimeInitializedClasses(BuildProducer producer) { + // Classes using java.util.Random, which need to be runtime initialized + producer.produce( + new RuntimeInitializedClassBuildItem("org.apache.kafka.common.security.authenticator.SaslClientAuthenticator")); + producer.produce(new RuntimeInitializedClassBuildItem( + "org.apache.kafka.common.security.oauthbearer.internals.expiring.ExpiringCredentialRefreshingLogin")); + } + @BuildStep void registerServiceBinding(Capabilities capabilities, BuildProducer serviceProvider) {