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

loading class of protobuf format descriptor by "Class.forName(className, true, Thread.currentThread().getContextClassLoader())" may can not find class because the current thread class loader may not contain this class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.16.2, 1.18.1
    • None
    • None
    • 1、standalone session
      2、flink on k8s

    Description

      1、Stack information:
      Caused by: java.lang.IllegalArgumentException: get test.ProtobufTest1 descriptors error!
          at org.apache.flink.formats.protobuf.util.PbFormatUtils.getDescriptor(PbFormatUtils.java:94)
          at org.apache.flink.formats.protobuf.serialize.PbRowDataSerializationSchema.<init>(PbRowDataSerializationSchema.java:49)
          at org.apache.flink.formats.protobuf.PbEncodingFormat.createRuntimeEncoder(PbEncodingFormat.java:47)
          at org.apache.flink.formats.protobuf.PbEncodingFormat.createRuntimeEncoder(PbEncodingFormat.java:31)
          at org.apache.flink.streaming.connectors.kafka.table.KafkaDynamicSink.createSerialization(KafkaDynamicSink.java:388)
          at org.apache.flink.streaming.connectors.kafka.table.KafkaDynamicSink.getSinkRuntimeProvider(KafkaDynamicSink.java:194)
          at org.apache.flink.table.planner.plan.nodes.exec.common.CommonExecSink.createSinkTransformation(CommonExecSink.java:150)
          at org.apache.flink.table.planner.plan.nodes.exec.stream.StreamExecSink.translateToPlanInternal(StreamExecSink.java:176)
          at org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase.translateToPlan(ExecNodeBase.java:159)
          at org.apache.flink.table.planner.delegation.StreamPlanner.$anonfun$translateToPlan$1(StreamPlanner.scala:85)
          at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)
          at scala.collection.Iterator.foreach(Iterator.scala:937)
          at scala.collection.Iterator.foreach$(Iterator.scala:937)
          at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
          at scala.collection.IterableLike.foreach(IterableLike.scala:70)
          at scala.collection.IterableLike.foreach$(IterableLike.scala:69)
          at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
          at scala.collection.TraversableLike.map(TraversableLike.scala:233)
          at scala.collection.TraversableLike.map$(TraversableLike.scala:226)
          at scala.collection.AbstractTraversable.map(Traversable.scala:104)

      2、my suggestion:
      Add a member variable to PbEncodingFormat: class loader instance, which is passed through DynamicTableFactory.Context method :getClassLoader()

      Attachments

        1. exception1.png
          140 kB
          jeremyMu
        2. sourcecode.jpg
          54 kB
          jeremyMu
        3. sourcecode2.png
          85 kB
          jeremyMu
        4. sourcecode3.png
          106 kB
          jeremyMu

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jeremymu jeremyMu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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