I am trying to create a simple bundle for Kafka producer in apache Karaf version 4.0.3 .
Here is my Java code
using Kafka client version 0.8.2.2_1, solved the issue .
I saw this same problem in 0.9.0. It turned out that a Thread context loader was set, and in that case Kafka uses that classloader to resolve. So the thread context classloader should either be:
null
Don't know if this is going to bite me, but adding:
Thread.currentThread().setContextClassLoader(null);
did the trick.
Might me useful for others, work around suggested in JIRA
props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, org.apache.kafka.common.serialization.StringSerializer.class);
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, org.apache.kafka.common.serialization.StringSerializer.class);