Faheem azaz Bhanej
Faheem azaz Bhanej

Reputation: 2396

Caused by: java.lang.ClassNotFoundException: kafka.admin.TopicCommand

I am trying to create topic in kafka. Here is my command.

.\bin\kafka-topics.sh --bootstrap-server localhost:9092 --create --topic myTopic --partitions 1 --replication-factor 1

But I get an exception while create topic caused by: java.lang.ClassNotFoundException: kafka.admin.TopicCommand. My kafka version is a 3.3.1 and kafka-topics.sh is located at C:\kafka_2.13-3.3.1\bin path.

Here is my kafka-topics.sh file

#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
# 
#    http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

exec $(dirname $0)/kafka-run-class.sh kafka.admin.TopicCommand "$@"

Upvotes: 0

Views: 775

Answers (1)

Faheem azaz Bhanej
Faheem azaz Bhanej

Reputation: 2396

My problem is solved. Instead of run a kafka-topics.sh, I run a kafka-topics.bat file. Which is located at C:\kafka_2.13-3.3.1\bin\windows.

Here is my new command

.\bin\windows\kafka-topics.bat --create --topic myTopic --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1

Upvotes: 1

Related Questions