kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Su She <suhsheka...@gmail.com>
Subject Question on running Kafka Producer in Java environment
Date Sat, 17 Jan 2015 02:11:09 GMT
Hello Everyone,

Thank you for the time and help. I had the Kafka Producer running, but am
having some trouble now.

1) Using Maven, I wrote a Kafka Producer similar to the one found here:

2) I am using these jar files: kafka_2.10-0.8.2-beta.jar,
kafka-clients-0.8.2-beta.jar, metrics-core-2.2.0.jar,
scala-library-2.10.4.jar, slf4j-api-1.5.6.jar, slf4j-log4j12-1.5.6.jar

3) I used to submit it via spark-submit script on my ec2-instance, but I
realized it was not good practice and want to submit it via the java

4) I did javac -cp "jar files" HKP.java and got a .class file

5) I did jar cmf manifest.mf (just the class and version) test.jar
HPK.class and got the jar file test.jar

6) I try to run it doing java -cp "jar files" -jar test.jar and I am
getting some "NoClassDefFoundErrors" first I had to download the slf4j-api
jar and now I am getting NoClassDefFoundError:
kafka/producer/ProducerConfig even though I have the Kafka jar files needed
and these 4 jar files worked when doing it through the spark-submit script.

Any suggestions are much appreciated!


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message