Support Questions
Find answers, ask questions, and share your expertise

Nifi Cannot connect to kafka with Kerberos: unable to find LoginModule class: com.sun.security.auth.module.Krb5LoginModule

Nifi Cannot connect to kafka with Kerberos: unable to find LoginModule class: com.sun.security.auth.module.Krb5LoginModule

Explorer

Nifi Cannot connect to kafka with Kerberos while I try to configure it using the following instruction

https://community.hortonworks.com/articles/26551/accessing-kerberos-enabled-kafka-topics-using-getk....

I got the error: unable to find LoginModule class: com.sun.security.auth.module.Krb5LoginModule

Any advice is appreciated.

2017-05-15 17:00:00,703 ERROR [Timer-Driven Process Thread-7] o.a.n.p.kafka.pubsub.ConsumeKafka ConsumeKafka[id=11281745-115c-12b5-0451-b59b388b0d9b] ConsumeKafka[id=11281745-115c-12b5-0451-b59b388b0d9b] failed to process due to org.apache.kafka.common.KafkaException: Failed to construct kafka consumer; rolling back session: org.apache.kafka.common.KafkaException: Failed to construct kafka consumer

2017-05-15 17:00:00,707 ERROR [Timer-Driven Process Thread-7] o.a.n.p.kafka.pubsub.ConsumeKafka org.apache.kafka.common.KafkaException: Failed to construct kafka consumer

at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:648) ~[kafka-clients-0.9.0.1.jar:na] at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:512) ~[kafka-clients-0.9.0.1.jar:na] at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:494) ~[kafka-clients-0.9.0.1.jar:na] at org.apache.nifi.processors.kafka.pubsub.ConsumerPool.createKafkaConsumer(ConsumerPool.java:137) ~[nifi-kafka-0-9-processors-1.1.1.jar:1.1.1] at org.apache.nifi.processors.kafka.pubsub.ConsumerPool.obtainConsumer(ConsumerPool.java:106) ~[nifi-kafka-0-9-processors-1.1.1.jar:1.1.1] at org.apache.nifi.processors.kafka.pubsub.ConsumeKafka.onTrigger(ConsumeKafka.java:286) ~[nifi-kafka-0-9-processors-1.1.1.jar:1.1.1] at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) ~[nifi-api-1.1.1.jar:1.1.1] at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1099) [nifi-framework-core-1.1.1.jar:1.1.1] at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:136) [nifi-framework-core-1.1.1.jar:1.1.1] at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47) [nifi-framework-core-1.1.1.jar:1.1.1] at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132) [nifi-framework-core-1.1.1.jar:1.1.1] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:522) [na:1.8.0-internal] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:319) [na:1.8.0-internal] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:191) [na:1.8.0-internal] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [na:1.8.0-internal] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153) [na:1.8.0-internal] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [na:1.8.0-internal] at java.lang.Thread.run(Thread.java:785) [na:1.8.0-internal]

Caused by: org.apache.kafka.common.KafkaException: javax.security.auth.login.LoginException: unable to find LoginModule class: com.sun.security.auth.module.Krb5LoginModule

at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:74) ~[kafka-clients-0.9.0.1.jar:na] at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:60) ~[kafka-clients-0.9.0.1.jar:na] at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:79) ~[kafka-clients-0.9.0.1.jar:na] at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:577) ~[kafka-clients-0.9.0.1.jar:na] ... 17 common frames omitted

Caused by: javax.security.auth.login.LoginException: unable to find LoginModule class: com.sun.security.auth.module.Krb5LoginModule

at javax.security.auth.login.LoginContext.invoke(LoginContext.java:828) ~[na:1.8.0-internal] at javax.security.auth.login.LoginContext.access$000(LoginContext.java:196) ~[na:1.8.0-internal] at javax.security.auth.login.LoginContext$4.run(LoginContext.java:698) ~[na:1.8.0-internal] at javax.security.auth.login.LoginContext$4.run(LoginContext.java:696) ~[na:1.8.0-internal] at java.security.AccessController.doPrivileged(AccessController.java:650) ~[na:1.8.0-internal] at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:696) ~[na:1.8.0-internal] at javax.security.auth.login.LoginContext.login(LoginContext.java:597) ~[na:1.8.0-internal] at org.apache.kafka.common.security.kerberos.Login.login(Login.java:298) ~[kafka-clients-0.9.0.1.jar:na] at org.apache.kafka.common.security.kerberos.Login.<init>(Login.java:104) ~[kafka-clients-0.9.0.1.jar:na] at org.apache.kafka.common.security.kerberos.LoginManager.<init>(LoginManager.java:44) ~[kafka-clients-0.9.0.1.jar:na] at org.apache.kafka.common.security.kerberos.LoginManager.acquireLoginManager(LoginManager.java:85) ~[kafka-clients-0.9.0.1.jar:na] ble to find LoginModule class: com.sun.security.auth.module.Krb5LoginModuleat org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:55) ~[kafka-clients-0.9.0.1.jar:na] ... 20 common frames omitted

3 REPLIES 3

Re: Nifi Cannot connect to kafka with Kerberos: unable to find LoginModule class: com.sun.security.auth.module.Krb5LoginModule

Hi @Andy Liang - from the log it looks like you're using NiFi 1.1.1 with the Kafka Nar for 0.9, can you please share your processor and nifi.properties configs for the connection and kerberos?

Re: Nifi Cannot connect to kafka with Kerberos: unable to find LoginModule class: com.sun.security.auth.module.Krb5LoginModule

You may want to double-check your JAAS file for typos or special characters. One time I ran into something like this after copying and pasting a JAAS file from somewhere, and then when I retyped everything it started working.

There could definitely be something else going on, but thought I would mention it.

Re: Nifi Cannot connect to kafka with Kerberos: unable to find LoginModule class: com.sun.security.auth.module.Krb5LoginModule

Super Collaborator

Hi @Andy Liang, please let me know if you were able to solve this issue. I am facing the same thing. Do you have to change the java package? Thanks in advance