Karaf - Kafka OSGI bundle - Producer issue

前端 未结 3 914
臣服心动
臣服心动 2021-01-14 05:46

I am trying to create a simple bundle for Kafka producer in apache Karaf version 4.0.3 .

Here is my Java code



        
3条回答
  •  被撕碎了的回忆
    2021-01-14 05:56

    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.

提交回复
热议问题