bash 无法找到或加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27726480/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain
提问by pborg
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.
我正在浏览 apache kafka 教程(在 apache kafka 网站上),不得不使用帮助教程(http://janschulte.wordpress.com/2013/10/13/apache-kafka-0-8-on -windows/)并找到另一个答案(在 VMware 中从我的 ubuntu 运行 kafka 时搜索“无法识别的 VM 选项‘+UseCompressedOops’”)只是为了在此处完成。
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
运行时找不到或加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain”:“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)
我之前做了一些搜索,发现一个没有明确答案和其他解决方案但适用于不同版本的电子邮件链(https://www.marshut.net/kiisyx/apache-kafka-error-on-windows-couldnot-find-or-加载主类quorumpeermain.html)
PS: I would have links in all parenthesis but my reputation isn't ready yet.
PS:我会在所有括号中都有链接,但我的声誉还没有准备好。
回答by Jaya Ananthram
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
可能你的课程路径有问题。该错误表示无法加载 QuorumPeerMain 类。这个类将在 zookeeper-(version).jar 中可用。确保 jar 在 libs 文件夹中可用,并确保您在类路径中指向了 lib 文件夹。显然类路径是在bin/kafka-run-class.sh中指向的。在最后的 kafka-run-class.sh 中你会发现一行
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.
echo $CLASSPATH
在上述行之前添加一条语句。现在尝试开始。这样您就可以找到传递给类路径的字符串。它应该包含:./../libs/zookeeper-(version).jar:
在 lib 文件夹中找到的版本应该与字符串匹配。默认情况下,它将完美运行。我认为有人更改了您下载的文件。如果是这样,那么它肯定会开始。
or try the steps prescribed in the below link, It worked for me
或尝试以下链接中规定的步骤,它对我有用