Pl check your classpath. Some jars might be missing. On Sat, Jan 17, 2015 at 7:41 AM, Su She <[email protected]> wrote:
> 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: > > https://github.com/pppsunil/HelloKafka/blob/master/src/main/java/com/spnotes/kafka/HelloKafkaProducer.java > > 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 > script. > > 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! > > Thanks! >
