kafka-offset-monitor 0.4.6在Linux跑的时候 无法找到 LoginModule 类:

bbabababa 发表于: 2019-11-26   最后更新时间: 2019-11-27  

提问说明

老大让我找一个kafka的可视化界面,要能够实时设置offset和查看消费进度和速度,用的kafka2.11版本,用github上的别人打包好的jar或者是自己打包的jar 用以下代码运行时都说找不到loginModule类,求助

java -Djava.security.auth.login.config=/usr/local/aclconf/kafka_client_jaas.conf \
-cp KafkaOffsetMonitor-assembly-0.4.6-SNAPSHOT.jar \
   com.quantifind.kafka.offsetapp.OffsetGetterWeb \
 --offsetStorage kafka \
 --kafkaBrokers kafka1:9092,kafka2:9092,kafka3:9092 \
 --kafkaSecurityProtocol SASL_PLAINTEXT \
 --zk zk1:2181,zk2:2181,zk3:2181\
 --port 8888 \
 --refresh 10.seconds \
 --retain 2.days \
 --dbName offsetapp_kafka
Caused by: org.apache.kafka.common.KafkaException: javax.security.auth.login.LoginException: 无法找到 LoginModule 类: org.apache.kafka.common.security.plain.PlainLoginModule
        at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:74)
        at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:60)
        at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:79)
        at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:577)
        ... 10 more
Caused by: javax.security.auth.login.LoginException: 无法找到 LoginModule 类: org.apache.kafka.common.security.plain.PlainLoginModule
        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:794)
        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:195)
        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:682)
        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:680)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
        at javax.security.auth.login.LoginContext.login(LoginContext.java:587)
        at org.apache.kafka.common.security.kerberos.Login.login(Login.java:298)
        at org.apache.kafka.common.security.kerberos.Login.<init>(Login.java:104)
        at org.apache.kafka.common.security.kerberos.LoginManager.<init>(LoginManager.java:44)
        at org.apache.kafka.common.security.kerberos.LoginManager.acquireLoginManager(LoginManager.java:85)
        at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:55)
        ... 13 more
2019-11-26 14:59:11 INFO  KafkaOffsetGetter$:319 - Creating new Kafka Client to get consumer group committed offsets
2019-11-26 14:59:11 INFO  ConsumerConfig:165 - ConsumerConfig values: 
        metric.reporters = []
        metadata.max.age.ms = 300000
        value.deserializer = class org.apache.kafka.common.serialization.ByteArrayDeserializer
        group.id = kafka-monitor-committedOffsetListener
        partition.assignment.strategy = [org.apache.kafka.clients.consumer.RangeAssignor]
        reconnect.backoff.ms = 50
        sasl.kerberos.ticket.renew.window.factor = 0.8

心跳崩了,弄了两天了还是这个问题



您需要解锁本帖隐藏内容请: 点击这里
本帖隐藏的内容




上一条: Too many TCP ports in CLOSE WAIT condition in kafka broker
下一条: 请问一下我该如何防止由于kafka节点落后被踢出ISR

  • 尝试了java -cp运行时带上org.apache.kafka包,但是就变成了启动都启动不了

    java -Djava.security.auth.login.config=/usr/local/aclconf/kafka_client_jaas.conf \
    -cp KafkaOffsetMonitor-assembly-0.4.6-SNAPSHOT.jar \
      com.quantifind.kafka.offsetapp.OffsetGetterWeb \
    --offsetStorage kafka \
    --kafkaBrokers kafka1:9092kafka2;9092,kafka3:9092 \
    --kafkaSecurityProtocol SASL_PLAINTEXT \
    --zk zk1:2181,zk2:2181,zk3:2181\
    --port 8888 \
    --refresh 10.seconds \
    --retain 2.days \
    --dbName offsetapp_kafka
    
    • 旧的0.2.0版本好像是没有的,新的0.4.6版本在github上有登录认证模块,现在已经解决了这个问题,出问题的根本是因为maven打包时不会引入外部的依赖,所以在启动kafkaoffsetmonitor时要在classpath下将这个依赖自己引进了,这个LoginModule是 kafka-clients-1.1.0.jar里的.

        • 追加classpath,如:

          java -Djava.security.auth.login.config=/etc/kafka/kafka_client_jaas.conf \
          -cp kafka-clients-0.10.2.0.jar:KafkaOffsetMonitor-assembly-0.4.6-SNAPSHOT.jar com.quantifind.kafka.offsetapp.OffsetGetterWeb \
               --offsetStorage kafka \
               --kafkaBrokers localhost:9093 \
               --kafkaSecurityProtocol SASL_PLAINTEXT \
               --zk localhost:2181 \
               --port 18080 \
               --refresh 10.seconds \
               --retain 2.days \
               --dbName offsetapp_kafka