Hi.

I have tried using 0.9.0.0, building an OSGi bundle and exporting the
packages. However, when creating a Producer, I get an Ex:

Caused by: org.apache.kafka.common.config.ConfigException: Invalid value
org.apache.kafka.clients.producer.internals.DefaultPartitioner for
configuration partitioner.class: Class
org.apache.kafka.clients.producer.internals.DefaultPartitioner could not be
found.

at org.apache.kafka.common.config.ConfigDef.parseType(ConfigDef.java:255)
~[kafka-clients-0.9.0.0.jar:na]
at org.apache.kafka.common.config.ConfigDef.define(ConfigDef.java:78)
~[kafka-clients-0.9.0.0.jar:na]
at org.apache.kafka.common.config.ConfigDef.define(ConfigDef.java:94)
~[kafka-clients-0.9.0.0.jar:na]
at org.apache.kafka.clients.producer.ProducerConfig.<clinit>(
ProducerConfig.java:206) ~[kafka-clients-0.9.0.0.jar:na]

That is because the static ProducerConfig initializer sets the Class name
and ConfigDef does a Class.forName, which does not work pretty well in OSGi
environments. But there is another way to set those "class" parameters, and
is using directly the class. So in my OSGi environment, changing
ProducerConfig:


                               .define(PARTITIONER_CLASS_CONFIG,
                                        Type.CLASS,
                                        DefaultPartitioner.class.getName(),
                                        Importance.MEDIUM,
PARTITIONER_CLASS_DOC)
for

                               .define(PARTITIONER_CLASS_CONFIG,
                                        Type.CLASS,
                                        DefaultPartitioner.class,
                                        Importance.MEDIUM,
PARTITIONER_CLASS_DOC)

works fine in OSGi too.

What do you think about this?

Thanks in advance.

Reply via email to