欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

kafka:解决 Classpath is empty 问题

程序员文章站 2022-06-07 10:21:45
...

kafka:解决 Classpath is empty 问题

key: Classpath is empty. Please build the project first e.g. by running ‘./gradlew jar -PscalaVersion=2.12.8’

环境:linux
启动kafka的时候,bin/kafka-server-start.sh config/server.properties, 出现Classpath is empty. Please build the project first e.g. by running './gradlew jar -PscalaVersion=2.12.8'的提示,启动失败。

*上有一个回答提到引发这个问题的原因:

  1. In my case it has nothing to do with the binary or source cause both of them give that same “classpath is empty please build the project first” error. Its because there is a space in the path where kafka resides.
  2. Please help to resolve this problem, I’m getting the same error, Classpath is empty. Please build the project first e.g. by running ‘./gradlew jar -PscalaVersion=2.11.12’ – nitinsridar Sep 9 '18 at 5:59
  3. This is the correct answer. When I removed the space in the Kafka folder name. It was able to start up again. Thanks for sharing the solution! – Babajide M. Moibi Oct 1 '18 at 8:06

问题原文链接

问题原因1:kafka安装路径中有空格,解决空格等问题即可。

但是,如果路径中没有空格呢?可能是你下载的kafka有问题。检查一下载命令:
http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/2.3.0/kafka-2.3.0-src.tgz`, 下载的是源码,不是binary。 重新下载

http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/2.3.0/kafka_2.12-2.3.0.tgz
tar -xzvf kafka_2.12-2.3.0.tgz
mv kafka_2.12-2.3.0 kafka
bin/zookeeper-server-start.sh -daemon config/zookeeper.properties

启动成功,问题解决。