Karaf - Kafka OSGI bundle - Producer issue

谁说我不能喝 提交于 2019-12-01 08:15:01
Frank Lee

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:

  • A classloader that can resolve all the Kafka related stuff
  • null

Don't know if this is going to bite me, but adding:

Thread.currentThread().setContextClassLoader(null);

did the trick.

using Kafka client version 0.8.2.2_1, solved the issue .

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);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!