[ 
https://issues.apache.org/jira/browse/CAMEL-10087?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15355574#comment-15355574
 ] 

Jay mann edited comment on CAMEL-10087 at 6/29/16 6:48 PM:
-----------------------------------------------------------

Daniel,

We need to put the same fix (setting classloader to null) for the Producer as 
well.  The kafka ProducerConfig has a static initializer that creates the 
DefaultPartiioner by default no matter what.

Here is the kafka path:

Static initializer:
https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java#L293

Defines default partitioner:
https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java#L110

Creates default instance of partitioner
https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java#L663


Since this is a static it only gets call on the first reference to the class, 
so it doesn't take into account what is  passed in from the camel-kafka 
producer.

PR here:
https://github.com/apache/camel/pull/1054




was (Author: jmandawg):
Daniel,

We need to put the same fix (setting classloader to null) for the Producer as 
well.  The kafka ProducerConfig has a static initializer that creates the 
DefaultPartiioner by default no matter what.

Here is the kafka path:

Static initializer:
https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java#L293

Defines default partitioner:
https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java#L110

Creates default instance of partitioner
https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java#L663


Since this is a static it only gets call on the first reference to the class, 
so it doesn't take into account what is passed in from the camel-kafka producer.




> camel-kafka does not work in OSGI container
> -------------------------------------------
>
>                 Key: CAMEL-10087
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10087
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-kafka
>    Affects Versions: 2.17.1
>            Reporter: Jay mann
>
> Currently this component is broken in OSGI environment due to this:
> https://issues.apache.org/jira/browse/KAFKA-3218
> We can leave it broken until they get their bugs worked out.  Or i can submit 
> a PR with an intermediate fix that should work, as described in the jira 
> noted above.
> https://github.com/apache/camel/pull/1053



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to