kafka 报 No serviceName defined in either JAAS or Kafka config

啊啊 发表于: 2024-11-04   最后更新时间: 2024-11-04 12:03:02   131 游览
[2024-11-04 04:02:06,705] ERROR Exiting Kafka due to fatal exception during startup. (kafka.Kafka$)
org.apache.kafka.common.KafkaException: java.lang.IllegalArgumentException: No serviceName defined in either JAAS or Kafka config
    at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:183)
    at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:192)
    at org.apache.kafka.common.network.ChannelBuilders.serverChannelBuilder(ChannelBuilders.java:107)
    at kafka.network.Processor.<init>(SocketServer.scala:977)
    at kafka.network.Acceptor.newProcessor(SocketServer.scala:882)
    at kafka.network.Acceptor.$anonfun$addProcessors$1(SocketServer.scala:852)
    at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:190)
    at kafka.network.Acceptor.addProcessors(SocketServer.scala:851)
    at kafka.network.DataPlaneAcceptor.configure(SocketServer.scala:525)
    at kafka.network.SocketServer.createDataPlaneAcceptorAndProcessors(SocketServer.scala:253)
    at kafka.network.SocketServer.$anonfun$new$31(SocketServer.scala:177)
    at kafka.network.SocketServer.$anonfun$new$31$adapted(SocketServer.scala:177)
    at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:619)
    at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:617)
    at scala.collection.AbstractIterable.foreach(Iterable.scala:935)
    at kafka.network.SocketServer.<init>(SocketServer.scala:177)
    at kafka.server.BrokerServer.startup(BrokerServer.scala:253)
    at kafka.server.KafkaRaftServer.$anonfun$startup$2(KafkaRaftServer.scala:97)
    at kafka.server.KafkaRaftServer.$anonfun$startup$2$adapted(KafkaRaftServer.scala:97)
    at scala.Option.foreach(Option.scala:437)
    at kafka.server.KafkaRaftServer.startup(KafkaRaftServer.scala:97)
    at kafka.Kafka$.main(Kafka.scala:112)
    at kafka.Kafka.main(Kafka.scala)
Caused by: java.lang.IllegalArgumentException: No serviceName defined in either JAAS or Kafka config
    at org.apache.kafka.common.security.kerberos.KerberosLogin.getServiceName(KerberosLogin.java:303)
    at org.apache.kafka.common.security.kerberos.KerberosLogin.configure(KerberosLogin.java:92)
    at org.apache.kafka.common.security.authenticator.LoginManager.<init>(LoginManager.java:61)
    at org.apache.kafka.common.security.authenticator.LoginManager.acquireLoginManager(LoginManager.java:112)
    at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:169)
    ... 22 more

我该如何解决?

发表于 2024-11-04
添加评论

没看到你的配置,你看是是否缺少:

sasl.enabled.mechanisms=PLAIN
security.inter.broker.protocol=SASL_PLAINTEXT

这2个参数。

这也是导致这个错误的原因之一。

你的答案

查看kafka相关的其他问题或提一个您自己的问题