javaapache-kafkawindows-subsystem-for-linuxapache-zookeeperconfluent-platform

Zookeeper Confluent Kafka 'Error opening file zookeeper-gc.log' when Running Confluent


I'm building a Kafka Application on Windows Subsystem for Linux 2 (WSL2).

I'm using Zookeeper 3.5.8, confluent-6.1.0 and java openjdk version 17.0.12.

I successfully installed all the above platforms on WSL2, however, when I run the command confluent local services start, I get the error Error: ZooKeeper failed to start.

Then when I run the zookeeper-server-start command independently to see the error causing the failure, I get the error [error][logging] Error opening log file '/mnt/c/../confluent-6.1.0/bin/../logs/zookeeper-gc.log': No such file or directory and another one Error: Could not create the Java Virtual Machine.

Java is installed correctly in WSL2 and the JAVA_HOME path is also set correctly on WSL2 (I've tested it and it works).

What could be the issue causing this?

Zookeeper-server-start command:


$ bin/zookeeper-server-start etc/kafka/zookeeper.properties

Error Log:


[0.006s][error][logging] Error opening log file '/mnt/c/Windows/system32/confluent-6.1.0/bin/../logs/zookeeper-gc.log': No such file or directory
[0.006s][logging] Initialization of output 'file=/mnt/c/Windows/system32/confluent-6.1.0/bin/../logs/zookeeper-gc.log' using options 'filecount=10,filesize=100M' failed.
Invalid -Xlog option '-Xlog:gc*:file=/mnt/c/Windows/system32/confluent-6.1.0/bin/../logs/zookeeper-gc.log:time,tags:filecount=10,filesize=100M', see error log for details.

Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Zookeeper.properties:


# the directory where the snapshot is stored.
dataDir=/tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
# disable the per-ip limit on the number of connections since this is a non-production config
maxClientCnxns=0
# Disable the adminserver by default to avoid port conflicts.
# Set the port to something non-conflicting if choosing to enable this
admin.enableServer=false
# admin.serverPort=8080


Solution

  • Confluent Platform didn't add Java 17 support until the latest versions. Official support of Java 17 came with Zookeeper 3.7. I had to migrate to a newer Confluent Platform. Also, Confluent decoupled Zookeeper for KRaft, which now manages consensus protocols for Kafka.