devshawn / kafka-gitops

🚀Manage Apache Kafka topics and generate ACLs through a desired state file.
https://devshawn.github.io/kafka-gitops
Apache License 2.0
322 stars 71 forks source link

plan dies with a nullpointer exception #81

Open userlarsb opened 3 years ago

userlarsb commented 3 years ago

After setting KAFKA_SASL_JAAS_USERNAME, KAFKA_SASL_JAAS_PASSWORD and KAFKA_BOOTSTRAP_SERVERS running kafka-gitops validate as well as kafka-gitops plan results in

java.lang.NullPointerException
    at com.devshawn.kafka.gitops.config.KafkaGitopsConfigLoader.handleAuthentication(KafkaGitopsConfigLoader.java:62)
    at com.devshawn.kafka.gitops.config.KafkaGitopsConfigLoader.setConfig(KafkaGitopsConfigLoader.java:41)
    at com.devshawn.kafka.gitops.config.KafkaGitopsConfigLoader.load(KafkaGitopsConfigLoader.java:18)
    at com.devshawn.kafka.gitops.StateManager.<init>(StateManager.java:63)
    at com.devshawn.kafka.gitops.cli.PlanCommand.call(PlanCommand.java:37)
    at com.devshawn.kafka.gitops.cli.PlanCommand.call(PlanCommand.java:19)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1783)
    at picocli.CommandLine.access$900(CommandLine.java:145)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2141)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2108)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1975)
    at picocli.CommandLine.execute(CommandLine.java:1904)
    at com.devshawn.kafka.gitops.MainCommand.main(MainCommand.java:76)

I tried it with both 0.2.14 and 0.2.15.

fireydagostino commented 3 years ago

Looking at the error - and checking the line in the code if (config.get(SaslConfigs.SASL_MECHANISM).equals("PLAIN")) {

You're likely missing the setting KAFKA_SASL_MECHANISM

jaykatti commented 2 years ago

It happened with me as well. The issue for me was - one of the config values are empty or null.

joschi commented 2 years ago

If you're still interested, this issue should have been fixed in https://github.com/joschi/kafka-gitops/releases/tag/0.2.16.

ubertot commented 2 years ago

Then we can actually close the issue. Thank you so much :)

joschi commented 2 years ago

Then we can actually close the issue. Thank you so much :)

Please note that https://github.com/joschi/kafka-gitops is an unofficial fork of this project. 😄