You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Randall Hauch (JIRA)" <ji...@apache.org> on 2019/08/11 15:48:00 UTC

[jira] [Updated] (KAFKA-8550) Connector validation fails with aliased converters

     [ https://issues.apache.org/jira/browse/KAFKA-8550?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Randall Hauch updated KAFKA-8550:
---------------------------------
    Fix Version/s: 2.3.1
                   2.4.0
                   2.2.2
                   2.1.2
                   2.0.2
                   1.1.2
                   1.0.3

> Connector validation fails with aliased converters
> --------------------------------------------------
>
>                 Key: KAFKA-8550
>                 URL: https://issues.apache.org/jira/browse/KAFKA-8550
>             Project: Kafka
>          Issue Type: Bug
>          Components: KafkaConnect
>    Affects Versions: 2.0.2, 2.3.0, 2.1.2, 2.2.2
>            Reporter: Chris Egerton
>            Assignee: Chris Egerton
>            Priority: Major
>             Fix For: 1.0.3, 1.1.2, 2.0.2, 2.1.2, 2.2.2, 2.4.0, 2.3.1
>
>
> During connector config validation, [ConfigDef.validateAll(...)|https://github.com/apache/kafka/blob/1ae92914e28919a97520e91bfd0e588d55eb1774/clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java#L497-L513] is invoked using a [Connector ConfigDef|https://github.com/apache/kafka/blob/trunk/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/ConnectorConfig.java]. This ConfigDef contains definitions for the [key and value converters|https://github.com/apache/kafka/blob/1ae92914e28919a97520e91bfd0e588d55eb1774/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/ConnectorConfig.java#L72-L78], which have the type [ConfigDef.Type.CLASS|https://github.com/apache/kafka/blob/1ae92914e28919a97520e91bfd0e588d55eb1774/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/ConnectorConfig.java#L167-L168]. When plugin aliases are used for these configs, an error is encountered and the connector configuration is rejected.
> This error occurs because [Class.forName(...)|https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#forName-java.lang.String-boolean-java.lang.ClassLoader-] is used to load the classes for these configs during validation. Even though the DelegatingClassLoader used by Connect successfully loads the requested class in its [loadClass(...)|https://github.com/apache/kafka/blob/1ae92914e28919a97520e91bfd0e588d55eb1774/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/DelegatingClassLoader.java#L358-L376] method, some (if not all) implementations of the Java runtime will then perform a check in their native Class.forName method to verify that the name of the loaded class matches the requested class name. For example, see [this section of OpenJDK|https://github.com/openjdk/jdk/blob/515e7600df738ebf8c42d38e322def012385e1b9/src/hotspot/share/classfile/systemDictionary.cpp#L1508-L1528] that performs the aforementioned check.
> A few possible fixes that come to mind include altering the connector validation in the AbstractHerder class to not use the ConfigDef.validateAll(...) method, or altering the logic used by the ConfigDef in its validateAll method for configs of type ConfigDef.Type.CLASS to use [ClassLoader.loadClass(...)|https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html#loadClass-java.lang.String-] either instead of or in addition to Class.forName(...).



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)