You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "KP (JIRA)" <ji...@apache.org> on 2018/08/26 20:13:00 UTC

[jira] [Updated] (KAFKA-7346) Cannot run Kafka Connect within a web application

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

KP updated KAFKA-7346:
----------------------
    Priority: Major  (was: Minor)

> Cannot run Kafka Connect within a web application
> -------------------------------------------------
>
>                 Key: KAFKA-7346
>                 URL: https://issues.apache.org/jira/browse/KAFKA-7346
>             Project: Kafka
>          Issue Type: Improvement
>          Components: KafkaConnect
>    Affects Versions: 1.1.1
>            Reporter: KP
>            Priority: Major
>
> The Plugins class loads plugins using DelegatingClassLoader whose parent class loader is Application class loader.
> public DelegatingClassLoader(List<String> pluginPaths) {
>     this(pluginPaths, ClassLoader.getSystemClassLoader()); //-> Application class loader
> }
> When running Kafka Connect within tomcat web applications, Plugins#pluginClass always throws ClassNotFoundException because "pluginClass" is loaded not by Application class loader but by ParallelWebAppClassLoader.
> protected static Class pluginClass(...){
>     Class<?> klass = loader.loadClass(classOrAlias, false);
>     if (pluginClass.isAssignableFrom(klass)) {    // -> returns false
>         return (Class<? extends U>) klass;
>     }
>      throw new ClassNotFoundException(...);
> }
>  
> Here is the class loader hierarchy when using JsonConverter:
> Converter
>     -ParallelWebAppClassLoader
>         - URLClassLoader (parent)
>             -Launcher$AppClassLoader (parent)
> JsonConverter
>     -PluginClassLoader
>         -DelegatingClassLoader(parent)
>             -Launher$AppClassLoader
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)