kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Withers, Robert" <Robert.With...@dish.com>
Subject NoClassDefFoundError exception when trying to instantiate a ProducerConfig
Date Fri, 05 Apr 2013 16:41:22 GMT
Hi,

I have an Eclipse java project, with the 2.9.1 scala jar (scala-library-2.9.1.RC4.jar) in
the build path, as well as the kafka_2.8.0-0.8-SNAPSHOT.jar.  I wrote the simple Producer
example and try to run it and it fails with a NoClassDefFoundError runtime exception.  Here
is my code and the error.   Thanks for any help!

package com.sample;

import java.util.Properties;

import kafka.javaapi.producer.Producer;
import kafka.producer.KeyedMessage;
import kafka.producer.ProducerConfig;

public class TestKafkaProducer {
       public static void main(String[] args) {
              Properties props = new Properties();
              props.put("zk.connect", "127.0.0.1:2181");
              props.put("serializer.class", "kafka.serializer.StringEncoder");
              props.put("partitioner.class", "example.producer.SimplePartitioner");
              props.put("request.required.acks", "1");
              ProducerConfig config = new ProducerConfig(props);
              Producer<String, String> producer = new Producer<String, String>(config);

              KeyedMessage<String, String> data = new KeyedMessage<String, String>("page_visits",
"kafka", "hello world");
              producer.send(data);
       }
}


And the error:
Exception in thread "main" java.lang.NoClassDefFoundError: scala/Tuple2$mcLL$sp
       at kafka.producer.ProducerConfig.<init>(ProducerConfig.scala:56)
       at com.sample.TestKafkaProducer.main(TestKafkaProducer.java:16)
Caused by: java.lang.ClassNotFoundException: scala.Tuple2$mcLL$sp
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       ... 2 more


Thanks,
Rob

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