Not able to produce message to Kafka topic


#1

Hi,
Can someone please help me produce messages to kafka topic from Java code. Wrote a simple Java Program to produce messages to Kafka topic
Ran the below command from command line to produce the messages

java -cp .:slf4j.jar:kafka-clients-0.10.0.0.jar:prod2.jar com.kafka.produce.ProduceMessage

Error:
Exception in thread “main” java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/JoranException
at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:189)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:112)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:105)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:235)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:221)
at org.apache.kafka.clients.producer.KafkaProducer.(KafkaProducer.java:131)
at com.kafka.produce.ProduceMessage.main(ProduceMessage.java:24)