[
https://issues.apache.org/jira/browse/KAFKA-8819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Randall Hauch resolved KAFKA-8819.
----------------------------------
Reviewer: Randall Hauch
Assignee: Greg Harris (was: Magesh kumar Nandakumar)
Resolution: Fixed
> Plugin path for converters not working as intended
> --------------------------------------------------
>
> Key: KAFKA-8819
> URL: https://issues.apache.org/jira/browse/KAFKA-8819
> Project: Kafka
> Issue Type: Bug
> Components: KafkaConnect
> Affects Versions: 2.3.0
> Reporter: Magesh kumar Nandakumar
> Assignee: Greg Harris
> Priority: Major
> Fix For: 2.0.2, 2.1.2, 2.2.2, 2.4.0, 2.5.0, 2.3.2
>
>
> KafakConnect allows all plugins to be available via a plugin path mechanism.
> This allows for classpath isolation. This is not working as designed under
> the following circumstances for Converters
>
> I have 2 directories under plugin path `connector1` and `connector2`. I
> intend to use AvroConverter and its available in both the plugin directories.
> Under these circumstances, the Worker attempts to create the Converter
> available in the plugin director first which should ideally be deterministic
> but it's not because of the following reasons:-
>
> [https://github.com/apache/kafka/blob/aa4ba8eee8e6f52a9d80a98fb2530b5bcc1b9a11/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Worker.java#L421]
> would lead to all configs of type Class to be loaded and this would mean
> that they are not loaded in the context of the connectors plugin loader.
> IIUC, the current loaded would be the DelegatingClassLoader. This would mean
> that the AvroConverter could potentially be loaded from connector2 plugin
> path while loading the class. This should be made deterministic as intended.
> i.e. if a Converter class is in the connector's plugin path that should be
> given the first priority.
>
> The converter is created and configured with the current class loaded as the
> Connector's class loader. This will not work if the converter uses reflection
> or other mechanisms like ServiceLoader in its constructor or configure
> method. Considering that the current class loader should be set to the
> Converter's class loaded while doing these operations.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)