3

I'm running through the tutorial for apache kafka (on the apache kafka website) and had to use a helper tutorial (http://janschulte.wordpress.com/2013/10/13/apache-kafka-0-8-on-windows/) and find another answer (search "Unrecognized VM option '+UseCompressedOops' when running kafka from my ubuntu in VMware") just to make it here.

Now I'm encountering the error:

Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain" when running:"bin/zookeeper-server-start.sh config/zookeeper.properties

I did some searching before and found an email chain without a definitive answer and other solutions but for different versions (https://www.marshut.net/kiisyx/apache-kafka-error-on-windows-couldnot-find-or-load-main-class-quorumpeermain.html)

PS: I would have links in all parenthesis but my reputation isn't ready yet.

trooper
  • 4,444
  • 5
  • 32
  • 32
pborg
  • 31
  • 1
  • 1
  • 4
  • 1
    Please download binary package (ex. apache-zookeeper-x.x.x-bin.tar.gz) from https://zookeeper.apache.org/releases.html. Do not download the source package. – debug May 29 '19 at 14:34

1 Answers1

2

Probably your class path is making trouble. The error says it could not able to load the QuorumPeerMain class. This class will be available at zookeeper-(version).jar. Make sure the jar is available at libs folder and also make sure that you have pointed lib folder in the classpath. Obviously the class path is pointed in the bin/kafka-run-class.sh. In the kafka-run-class.sh at the end you will find a line

if [ "x$DAEMON_MODE" = "xtrue" ]; then

add a statement echo $CLASSPATH before the above line. Now try to start. So that you can find what string is passing to the classpath. It should contain :./../libs/zookeeper-(version).jar: The version found in the lib folder should match with the string. By default it will work perfectly. I think some one has changed your downloaded file. If it so then surely it will start.

or try the steps prescribed in the below link, It worked for me

http://kafka.apache.org/07/quickstart.html

Jaya Ananthram
  • 3,433
  • 1
  • 22
  • 37
  • It gave the output: "bin/zookeeper-server-start.sh config/zookeeper.properties :/cygdrive/c/kafka/bin/../core/build/dependant-libs- ... /cygdrive/c/kafka/bin/../libs/zookeeper-3.3.4.jar:/cygdrive/c/kafka/bin/../core/build/libs/kafka_2.8.0*.jar Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain:" the zookeeper version number matches up but the kafka doesn't. – pborg Jan 05 '15 at 20:59
  • I'm find it difficult to find instances without scala for 2.8.0. I may have mixed tutorials and messed this up. I'm going to try a solution a coworker sent me and see if it works – pborg Jan 05 '15 at 21:17
  • 2
    Try by hard coding the classpath. Add `CLASSPATH="$CLASSPATH:../libs/zookeeper-3.3.4.jar:../libs/kafka_2.8.0-0.8.1.1.jar:"` before the line `if [ "x$DAEMON_MODE" = "xtrue" ]; then`. Make sure the same version of zookeeper and kafka is available at libs folder – Jaya Ananthram Jan 19 '15 at 09:20