You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Hugo Gu (Jira)" <ji...@apache.org> on 2024/04/03 09:40:00 UTC

[jira] [Created] (FLINK-34996) Deserializer can't be instantiated when connector-kafka installed into Flink Libs

Hugo Gu created FLINK-34996:
-------------------------------

             Summary: Deserializer can't be instantiated when connector-kafka installed into Flink Libs
                 Key: FLINK-34996
                 URL: https://issues.apache.org/jira/browse/FLINK-34996
             Project: Flink
          Issue Type: Bug
          Components: Connectors / Kafka
            Reporter: Hugo Gu
         Attachments: image-2024-04-03-17-34-00-120.png, image-2024-04-03-17-37-55-105.png

The current implementation of the 
KafkaValueOnlyDeserializerWrapper Class instantiates Deserializer from the ClassLoader of the KafkaValueOnlyDeserializerWrapper itself as following figure shows.
 
!image-2024-04-03-17-34-00-120.png|width=799,height=293!
 
In case of both following conditions are met:
1. The connector-kafka get installed into Libs of Flink (rather than in the User Jar)
2. The user jar defines a customized Deserializer for Kafka Record. 
 
The instantiation of the custom deserializer will fail due to NoClassFound exception because it is indeed not available in the system class loader. 
 
As following figure illustrates
 
!image-2024-04-03-17-37-55-105.png|width=413,height=452!
 
It can be fixed by using either UserCodeClassLoader or the ClassLoader of current Thread.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)