Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-17150

Connect converter validation does not accept class aliases

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 3.8.0
    • 3.8.0
    • connect
    • None

    Description

      Connect allows users to specify aliases instead of full classes when configuring plugins. For example, the following configuration is valid:

      {
              "connector.class": "FileStreamSource",
              "topic": "anything",
              "key.converter": "JsonConverter"
      }

      In <= 3.7.1 this will pass validation and function correctly.

      In 3.8.0-rc1 this will instead fail with this error message:

      [2024-07-16 13:58:54,250] ERROR Failed to instantiate key converter class JsonConverter; this should have been caught by prior validation logic (org.apache.kafka.connect.runtime.AbstractHerder:462)
      java.lang.ClassNotFoundException: JsonConverter
      	at java.base/java.lang.Class.forName0(Native Method)
      	at java.base/java.lang.Class.forName(Class.java:534)
      	at java.base/java.lang.Class.forName(Class.java:513)
      	at org.apache.kafka.common.utils.Utils.loadClass(Utils.java:426)
      	at org.apache.kafka.common.utils.Utils.newInstance(Utils.java:415)
      	at org.apache.kafka.connect.runtime.AbstractHerder.validateConverterConfig(AbstractHerder.java:460)
      	at org.apache.kafka.connect.runtime.AbstractHerder.validateKeyConverterConfig(AbstractHerder.java:528)
      	at org.apache.kafka.connect.runtime.AbstractHerder.validateConnectorConfig(AbstractHerder.java:734)
      	at org.apache.kafka.connect.runtime.AbstractHerder.lambda$validateConnectorConfig$3(AbstractHerder.java:574)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
      	at java.base/java.lang.Thread.run(Thread.java:1583)

      and this error will eventually be shown to the user:

      Connector configuration is invalid and contains the following 1 error(s):
      Failed to load class JsonConverter: JsonConverter

      When the full class name is specified, the class is found and passes validation.

      Attachments

        Issue Links

          Activity

            People

              gharris1727 Greg Harris
              gharris1727 Greg Harris
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: