我正在使用快速入门中的示例代码来实现apache-kafka。在创建新的生产者时,我一直遇到以下错误,并且在网络上没有太多关于错误的详细信息:
try {
producer = new kafka.javaapi.producer.Producer<String, String>(
new ProducerConfig(props));
} catch (Exception e) {
System.out.println("PRODUCER Error"+ e);
}
创建的错误:
Exception in thread "main" java.lang.VerifyError: class scala.Tuple2$mcLL$sp overrides
final method _1.()Ljava/lang/Object;
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at kafka.producer.ProducerConfig.<init>(ProducerConfig.scala:56)
at com.datacollector.Producer.<init>(Producer.java:50)
at com.datacollector.MainProducerRawData.main(MainProducerRawData.java:117)
答案 0 :(得分:0)
感谢所有回复。我终于弄明白了。我需要运行scala和kafka库的更新版本,因为它们不匹配。