Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain

Hello All,

I just downloaded confluent
https://packages.confluent.io/archive/7.8/confluent-community-7.8.0.zip. trying to install on Ubuntu 20.04 and getting this below error while starting zookeeper service. any help would be appreciated.

root@…bin# ./zookeeper-server-start …/config/zookeeper.properties
Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain
Caused by: java.lang.ClassNotFoundException: org.apache.zookeeper.server.quorum.QuorumPeerMain

Thanks

I’m not able to repro this. A few things to check:

  1. Ensure that $CONFLUENT_HOME/share/java/kafka/zookeeper-3.8.4.jar is present on your file system
  2. Ensure that the command jar tf $CONFLUENT_HOME/share/java/kafka/zookeeper-3.8.4.jar | grep QuorumPeerMain outputs org/apache/zookeeper/server/quorum/QuorumPeerMain.class
  3. If 1 and 2 are both confirmed, double check that the java process that kicks off when you run zookeeper-server-start has $CONFLUENT_HOME/share/java/kafka/ as a -cp (classpath) argument. The command will look like the following and you should see something like -cp /path/to/confluent-7.8.0/bin/../share/java/kafka/*:... in it:

java -Xmx512M -Xms512M -server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent -XX:MaxInlineLevel=15 -Djava.awt.headless=true -Xlog:gc*:file=/path/to/confluent-7.8.0/bin/../logs/zookeeper-gc.log:time,tags:filecount=10,filesize=100M -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dkafka.logs.dir=/path/to/confluent-7.8.0/bin/../logs -Dlog4j.configuration=file:/path/to/confluent-7.8.0/bin/../etc/kafka/log4j.properties -cp /path/to/confluent-7.8.0/bin/../share/java/kafka/*:/path/to/confluent-7.8.0/bin/../share/java/confluent-telemetry/* org.apache.zookeeper.server.quorum.QuorumPeerMain /path/to/confluent-7.8.0/etc/kafka/zookeeper.properties

root@…/kafka# jar -tf zookeeper-3.8.4.jar | grep QuorumPeerMain
java.util.zip.ZipException: zip END header not found
at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1776)
at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1659)
at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1666)
at java.base/java.util.zip.ZipFile$Source.(ZipFile.java:1470)
at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1433)
at java.base/java.util.zip.ZipFile$CleanableResource.(ZipFile.java:743)
at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:860)
at java.base/java.util.zip.ZipFile.(ZipFile.java:258)
at java.base/java.util.zip.ZipFile.(ZipFile.java:187)
at java.base/java.util.zip.ZipFile.(ZipFile.java:158)
at jdk.jartool/sun.tools.jar.Main.list(Main.java:1505)
at jdk.jartool/sun.tools.jar.Main.run(Main.java:386)
at jdk.jartool/sun.tools.jar.Main.main(Main.java:1686)

That’d cause this. It looks like the jar is incomplete (should be around 1.3 MB) or corrupted. See if a reinstall will get you past that error.

Now I downloaded the package from https://packages.confluent.io/archive/7.8/confluent-community-7.8.0.tar.gz and it worked.
So it is the one we need to use?