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

Randall Hauch commented on KAFKA-5953:
--------------------------------------

[~jpechane] wrote:

{quote}
As a result a DriverManager calls ServiceLoader and searches for all JDBC 
drivers. The postgres driver from connector 2) is found associated with 
classloader from connector 1).
{quote}

The DriverManager will call ServiceLoader to search for all JDBC drivers the 
first time the DriverManager is loaded. If Connect loads connector 1 first, 
then the DriverManager would search the classpath that includes the plugin for 
connector 1, but I don't understand how/why it would find the driver for 
connector 2 since that plugin's classloader is not used at this point. It does 
make sense, however, that once connector 2 is loaded, it would not find the 
PostgreSQL driver because the DriverManager has already called ServiceLoader 
and will not search the new classloader.

> Connect classloader isolation may be broken for JDBC drivers
> ------------------------------------------------------------
>
>                 Key: KAFKA-5953
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5953
>             Project: Kafka
>          Issue Type: Bug
>          Components: KafkaConnect
>    Affects Versions: 0.11.0.0
>            Reporter: Jiri Pechanec
>            Priority: Critical
>
> Let's suppose there are two connectors deployed
> # using JDBC driver (Debezium MySQL connector)
> # using PostgreSQL JDBC driver (JDBC sink).
> Connector 1 is started first - it executes a statement
> {code:java}
> Connection conn = DriverManager.getConnection(url, props);
> {code}
> As a result a {{DriverManager}} calls {{ServiceLoader}} and searches for all 
> JDBC drivers. The postgres driver from connector 2) is found associated with 
> classloader from connector 1).
> Connector 2 is started after that - it executes a statement
> {code:java}
> connection = DriverManager.getConnection(url, username, password);
> {code}
> DriverManager finds the connector that was loaded in step before but becuase 
> the classloader is different - now we use classloader 2) so it refuses to 
> load the class and no JDBC driver is found.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to