import org.apache.kafka.clients.producer.{KafkaProducer,ProducerRecord};import java.util.Properties;
object KafkaDemo { def main(args: Array[String]) { println("Hello world!") val properties= new Properties() properties.put("metadata.broker.list", "localhost:9092") val producer = new KafkaProducer[Object, String](properties) producer.send(new ProducerRecord("test", "test content")) }}
[error] (run-main-0) org.apache.kafka.common.config.ConfigException: Missing required configuration "value.serializer" which has no default value.org.apache.kafka.common.config.ConfigException: Missing required configuration "value.serializer" which has no default value. at org.apache.kafka.common.config.ConfigDef.parse(ConfigDef.java:124) at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:48) at org.apache.kafka.clients.producer.ProducerConfig.<init>(ProducerConfig.java:235) at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:129) at KafkaDemo$.main(KafkaDemo.scala:9) at KafkaDemo.main(KafkaDemo.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606)
public static final String KEY_SERIALIZER_CLASS_CONFIG = "key.serializer";
public static final String VALUE_SERIALIZER_CLASS_CONFIG = "value.serializer";To view this discussion on the web visit https://groups.google.com/d/msgid/kafka-clients/d14981a8-791b-4ff9-9552-8408bac5c02a%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "kafka-clients" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kafka-client...@googlegroups.com.
To post to this group, send email to kafka-...@googlegroups.com.
Visit this group at http://groups.google.com/group/kafka-clients.
Wow, was I directed from Kafka API docs wrongly ? It leads me to the old configuration specification.Anyway it's my fault that I have not noticed the new producer configuration. Thank you kumar, I will modify my project accordingly.Hope the API docs be refreshed soon.
--Warmest regards!
Zheng.Weitao(郑炜韬)University: South China University of Technology
Major : Network EngineeringCompany:Tencent,Inc.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
To view this discussion on the web visit https://groups.google.com/d/msgid/kafka-clients/af9e1375-1af0-4f19-a320-f3b340e35309%40googlegroups.com.