In this article, we will explain how to resolve the “Could not find a ‘KafkaClient’ entry in the JAAS configuration. System property ” in Kafka cluster.
Kafka Error:
[2020-12-16 19:50:04,441] ERROR Stopping due to error (org.apache.kafka.connect.cli.ConnectDistributed:84) org.apache.kafka.common.KafkaException: Failed to create new KafkaAdminClient at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:479) at org.apache.kafka.clients.admin.Admin.create(Admin.java:71) at org.apache.kafka.connect.util.ConnectUtils.lookupKafkaClusterId(ConnectUtils.java:44) at org.apache.kafka.connect.cli.ConnectDistributed.startConnect(ConnectDistributed.java:95) at org.apache.kafka.connect.cli.ConnectDistributed.main(ConnectDistributed.java:78) Caused by: java.lang.IllegalArgumentException: Could not find a 'KafkaClient' entry in the JAAS configuration. System property 'java.security.auth.login.config' is not set at org.apache.kafka.common.security.JaasContext.defaultContext(JaasContext.java:133) at org.apache.kafka.common.security.JaasContext.load(JaasContext.java:98) at org.apache.kafka.common.security.JaasContext.loadClientContext(JaasContext.java:84) at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:134) at org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:73) at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:105) at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:454) ... 4 more
Resolution:
Step 1: First, we will check whether jass configuration file is available or not in the Kafka cluster
==> How to check jaas configuration file in Kafka using find command
==> find / -name kafka_server_jaas.conf
If file is there in your Kafka cluster then execute the below command.
Step 2: Directly execute below command in CLI as a root user
export KAFKA_OPTS = " -Djava.security.auth.login.config = /etc/kafka/kafka_server_jaas.conf"
Note: In case, in you’re cluster there is no jaas configuration file then simply restart the Kafka and Zookeeper server.
The above resolutions are very simple to resolve the Kafka jaas configurations by using Kafka export command.
If anyone find any other resolutions kindly comment on it. It will helpful for others.