无法找到或加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain

问题描述:

我正在浏览 apache kafka 教程(在 apache kafka 网站上),不得不使用帮助教程(http://janschulte.wordpress.com/2013/10/13/apache-kafka-0-8-on-windows/) 并找到另一个答案(在 VMware 中从我的 ubuntu 运行 kafka 时搜索无法识别的 VM 选项‘+UseCompressedOops’")只是为了在这里制作.

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.

现在我遇到了错误:

无法找到或加载主类org.apache.zookeeper.server.quorum.QuorumPeerMain"时运行:"bin/zookeeper-server-start.sh config/zookeeper.properties

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

我之前做了一些搜索,发现一个没有明确答案的电子邮件链和其他解决方案,但适用于不同的版本(https://www.marshut.net/kiisyx/apache-kafka-error-on-windows-couldnot-find-或-load-main-class-quorumpeermain.html)

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:我会在所有括号中都有链接,但我的声誉还没有准备好.

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

可能是您的类路径出了问题.该错误表示无法加载 QuorumPeerMain 类.这个类将在 zookeeper-(version).jar 中可用.确保 jar 在 libs 文件夹中可用,并确保您在类路径中指向了 lib 文件夹.显然类路径是在bin/kafka-run-class.sh中指向的.在最后的 kafka-run-class.sh 中你会发现一行

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

在上述行之前添加一个语句 echo $CLASSPATH.现在尝试开始.这样您就可以找到传递给类路径的字符串.它应该包含 :./../libs/zookeeper-(version).jar: 在 lib 文件夹中找到的版本应该与字符串匹配.默认情况下,它将完美运行.我认为有人更改了您下载的文件.如果是这样,那么它肯定会启动.

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一>