且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-02-24 03:59:18

可能是您的类路径出了问题.该错误表示无法加载 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一>