Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-34996

Custom Deserializer can't be instantiated when connector-kafka installed into Flink Libs

    XMLWordPrintableJSON

Details

    Description

      The current implementation of the 
      KafkaValueOnlyDeserializerWrapper Class instantiates Deserializer from the ClassLoader of the KafkaValueOnlyDeserializerWrapper itself as following figure shows.
       

       
      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
       

       
      It can be fixed by using either UserCodeClassLoader or the ClassLoader of current Thread.

      Attachments

        1. image-2024-04-03-17-37-55-105.png
          85 kB
          Hugo Gu
        2. image-2024-04-03-17-34-00-120.png
          176 kB
          Hugo Gu

        Issue Links

          Activity

            People

              hugogu Hugo Gu
              hugogu Hugo Gu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h
                  3h