Kafka java client 0.8.2 error.

1,956 views
Skip to first unread message

Prabhath Pathirana

unread,
Feb 10, 2015, 2:39:58 AM2/10/15
to kafka-...@googlegroups.com
When I tried to initialize the producer it gives the following error.

org.apache.kafka.common.config.ConfigException: Missing required configuration "value.serializer" which has no default value.

My code is like below,
Properties props = new Properties();
props.put("metadata.broker.list", this.properties.getProperty("kafkaBrokers"));
props.put("serializer.class", "kafka.serializer.StringEncoder");
props.put("request.required.acks", "1");
producer = new org.apache.kafka.clients.producer.KafkaProducer(props);

What property should I set to avoid this error. I could not find any documentation or examples related to this.

Manikumar Reddy

unread,
Feb 10, 2015, 2:43:13 AM2/10/15
to Prabhath Pathirana, kafka-...@googlegroups.com
You can just set StringEncoder for value.serializer also.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kafka-clients/f454c0c9-252e-4829-8a28-335f10f23f41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cdhar B

unread,
Feb 21, 2015, 9:50:23 AM2/21/15
to kafka-...@googlegroups.com
Hi,

I am struggling to find a Kafka 0.8.2 new producer working example.
Please share if anybody has.

Appreciate your quick help.

Thanks,
Cdhar

Ziv Singer

unread,
Feb 25, 2015, 3:50:04 AM2/25/15
to kafka-...@googlegroups.com
I am struggling to find any Kafka producer working example,
if you have one you could share with me I'll be greteful

Manikumar Reddy

unread,
Feb 25, 2015, 4:12:35 AM2/25/15
to Ziv Singer, kafka-...@googlegroups.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.

Ziv Singer

unread,
Feb 25, 2015, 5:20:02 AM2/25/15
to Manikumar Reddy, kafka-...@googlegroups.com
I've changed the local host to the ip of my kafka server and the topic to my test topic.
this code doesn't work as well sadly.
any suggestions?

Manikumar Reddy

unread,
Feb 25, 2015, 5:25:10 AM2/25/15
to Ziv Singer, kafka-...@googlegroups.com
pl enable and post debug logs.

Ziv Singer

unread,
Feb 25, 2015, 5:27:55 AM2/25/15
to kafka-...@googlegroups.com, ziv.s...@gmail.com, ku...@nmsworks.co.in
thanks, but still doesn't work.
I've changed the local host to the ip of my kafka server and the topic to my test topic.
this code doesn't work as well sadly.
any suggestions?

Ziv Singer

unread,
Feb 25, 2015, 6:22:12 AM2/25/15
to kafka-...@googlegroups.com, ziv.s...@gmail.com, ku...@nmsworks.co.in
no logs, it doesn't seem to do anything in send method and it get stuck in close() on thread.join and when terminate the process i get this log in the kafka server: 
---------------------------------------------------------------------------------------
[2015-02-25 10:36:41,126] ERROR Closing socket for /82.166.148.154 because of error (kafka.network.Processor)
java.io.IOException: Connection reset by peer
        at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:197)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
        at kafka.utils.Utils$.read(Utils.scala:380)
        at kafka.network.BoundedByteBufferReceive.readFrom(BoundedByteBufferReceive.scala:54)
        at kafka.network.Processor.read(SocketServer.scala:444)
        at kafka.network.Processor.run(SocketServer.scala:340)
        at java.lang.Thread.run(Thread.java:745)
----------------------------------------------------------------------------------------------------------------------------------
Also, when I run the program from the server with "localhost" instead of the server ip it works fine.
so I guess there is a problem of connection to the server from my computer or other machines (tried it too)

Stepan Samarin

unread,
Feb 25, 2015, 10:00:24 AM2/25/15
to kafka-...@googlegroups.com, ziv.s...@gmail.com, ku...@nmsworks.co.in
I'm actually struggling with consumer for 0.8.2 now. If you have working example - please share.
I'm getting (after the start of consumer I wrote, using KafkaConsumer class):
15:51:37.442 [main] WARN  o.a.k.c.consumer.ConsumerConfig - The configuration group.id = test was supplied but isn't a known config.
15:51:37.442 [main] WARN  o.a.k.c.consumer.ConsumerConfig - The configuration partition.assignment.strategy = test was supplied but isn't a known config.

Jun Rao

unread,
Feb 25, 2015, 9:03:55 PM2/25/15
to Stepan Samarin, kafka-...@googlegroups.com, ziv.s...@gmail.com, Mani Kumar Reddy Obili
The consumer in o.a.k.c in 0.8.2 doesn't work yet (it's just the interface). We are developing it in trunk right now and expect to complete it by the next release.

Thanks,

Jun

Ziv Singer

unread,
Feb 26, 2015, 2:47:00 AM2/26/15
to Jun Rao, Stepan Samarin, kafka-...@googlegroups.com, Mani Kumar Reddy Obili
I've managed to solve the problem. in order to communicate from my pc to the server I had to add the kafka address to the local hosts file in my computer
Reply all
Reply to author
Forward
0 new messages