Morningstar / kafka-offset-monitor

A small web app to monitor the progress of kafka consumers and their lag wrt the log.
Apache License 2.0
281 stars 109 forks source link

Exception in client-jaas.conf :org.apache.kafka.common.KafkaException: java.lang.SecurityException: java.io.IOException: Configuration Error: Line 3: expected [=], found [username] #42

Open zealot-shin opened 4 years ago

zealot-shin commented 4 years ago

when I run with command in Read.md like this: java -Djava.security.auth.login.config=./server-client-jaas.conf \ -cp KafkaOffsetMonitor-assembly-0.4.6-SNAPSHOT.jar \ com.quantifind.kafka.offsetapp.OffsetGetterWeb \ --offsetStorage kafka \ --kafkaBrokers xxxx:9092 \ --kafkaSecurityProtocol SASL_PLAINTEXT \ --zk xxxx:2181 \ --port 8081 \ --refresh 10.seconds \ --retain 2.days \ --dbName offsetapp_kafka

and with my ./server-client-jaas.conf like this: KafkaClient { org.apache.kafka.common.security.plain.PlainLoginModule required     username="qingteng"     password="qeuo3GaZyXeUPy8X"; };

i got error like this: ERROR OffsetGetter$:103 - Error creating ZkUtils. Will attempt to re-create in 30000 seconds org.apache.kafka.common.KafkaException: java.lang.SecurityException: java.io.IOException: Configuration Error: Line 3: expected [=], found [username] at org.apache.kafka.common.security.JaasUtils.isZkSecurityEnabled(JaasUtils.java:102) at com.quantifind.kafka.OffsetGetter$.createZkUtils(OffsetGetter.scala:246) at com.quantifind.kafka.OffsetGetter$.getInstance(OffsetGetter.scala:273) at com.quantifind.kafka.offsetapp.OffsetGetterWeb$.reportOffsets(OffsetGetterWeb.scala:74) at com.quantifind.kafka.offsetapp.OffsetGetterWeb$$anonfun$schedule$1.apply$mcV$sp(OffsetGetterWeb.scala:99) at com.quantifind.kafka.offsetapp.OffsetGetterWeb$$anon$2.run(OffsetGetterWeb.scala:48) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.SecurityException: java.io.IOException: Configuration Error: Line 3: expected [=], found [username] at sun.security.provider.ConfigFile$Spi.(ConfigFile.java:137) at sun.security.provider.ConfigFile.(ConfigFile.java:102) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at java.lang.Class.newInstance(Class.java:442) at javax.security.auth.login.Configuration$2.run(Configuration.java:255) at javax.security.auth.login.Configuration$2.run(Configuration.java:247) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.login.Configuration.getConfiguration(Configuration.java:246) at org.apache.kafka.common.security.JaasUtils.isZkSecurityEnabled(JaasUtils.java:99) ... 12 more Caused by: java.io.IOException: Configuration Error: Line 3: expected [=], found [username] at sun.security.provider.ConfigFile$Spi.ioException(ConfigFile.java:666) at sun.security.provider.ConfigFile$Spi.match(ConfigFile.java:532) at sun.security.provider.ConfigFile$Spi.parseLoginEntry(ConfigFile.java:478) at sun.security.provider.ConfigFile$Spi.readConfig(ConfigFile.java:427) at sun.security.provider.ConfigFile$Spi.init(ConfigFile.java:329) at sun.security.provider.ConfigFile$Spi.init(ConfigFile.java:271) at sun.security.provider.ConfigFile$Spi.(ConfigFile.java:135) ... 23 more

it seems that client-jaas.conf's configuration is not right. But most says this is what it should be in this conf file. So i'm wondering maybe it's my kafka version' problem. My kafka server version is : 2.3.1