Could not find or load main class org.apache.zooke

2019-07-23 23:06发布

This question already has an answer here:

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.

1条回答
Rolldiameter
2楼-- · 2019-07-23 23:07

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

查看更多
登录 后发表回答