Cannot access Kafka Topics

#1

Hello,

So I am working on adding some custom pipelines into my copy of RockNSM for a research topic. I am trying to add topics to Kafka for this purpose. Usually I would use the kafka-topics.sh script for this purpose. But when I went to use the command ./kafka-topics.sh --list --zookeeper localhost:2181 I am receiving the following error: “Classpath is empty. Please build the project first e.g. by running ‘./gradlew jar -PscalaVersion=2.12.8’”. Now this is the latest ISO of RockNSM 2.4.1. I checked on the previous ISO 2.3 and found that this error does not occur. When I use the identical command it properly lists the topics. I also noticed that the file location was changed between versions. Kafka use to be placed in /opt while it is now in /usr/share. Anyone know how I can get around this error?

0 Likes

#2

Hi @ipninichuck! We indeed repackaged Kafka for RockNSM 2.4. We started fresh with Kafka 2.x to bring in the latest. I was able to replicate your issue, and you came across a bug that we certainly didn’t intend. We’ll fix our package to address this, but in the meantime here’s a quick work-around.

# We need to fix permissions too
sudo -s 
cd /usr/share/kafka
# Set the CLASSPATH environment variable to include all Kafka jars
cp=; for item in /var/lib/kafka/*.jar; do cp="${cp}:${item}"; done; export CLASSPATH=${cp};
# Use the newer client API to list the topics
./bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --list 

Hope that helps. I also opened an issue that we’ll fix the RPM for this. Thanks for engaging the community!

0 Likes

#3

Thank you…that fixed it. I think your answer got cut off though(I checked it on the github issue). The end is export CLASSPATH =${cp}; Like I said it just got cut off here. Figured I would add it in case someone comes across it. Also when I try using the newer client API it just hangs up, but when I use the older method of using the --zookeeper localhost:2181 option it lists them properly. Not sure on that one. Thought I report it though.

0 Likes

#4

Never mind on the answer getting cut off…I realized I just did not scroll to the right. It has been a long day indeed.

1 Like