Skip to main content

Failed to find any class that implements Connector: fixes

Kafka Connect answers Failed to find any class that implements Connector and which name matches ... when you create a connector whose class the worker did not load. The same text is the trace of a FAILED connector when a plug-in goes missing under a connector that already exists.

OLake Go is an open source alternative to Apache Kafka Connect for loading database changes into Apache Iceberg. Every fix on this page works without it. OLake is not affiliated with the Apache Software Foundation.

The short answer. Ask the worker what it loaded with curl -s localhost:8083/connector-plugins. If the class is not in that list, one of these is the cause:

  • The jars are not where plugin.path looks, or plugin.path points one level too deep, at the folder that holds the jars.
  • The worker was not restarted after the jars were put there.
  • The plug-in is incomplete, or it needs a newer Java than the worker runs.

Give each plug-in its own folder, set plugin.path to the parent of that folder, and restart every worker. The message itself helps: it ends with the list of connectors the worker did load.

Key takeaways

  • plugin.path names the folder that contains the plug-in folders, never the folder that holds the jars. One level too deep, both Kafka Connect 3.2.0 and Kafka Connect 4.3.1 loaded every jar as a plug-in of its own and the connector was not found.
  • Kafka Connect 4.3.1 says why in the worker log, with Failed to discover SourceConnector and a NoClassDefFoundError. Kafka Connect 3.2.0 logged nothing about the plug-in it could not load.
  • A half-installed plug-in can still be listed. Without its driver jar the connector appeared in GET /connector-plugins, and creating it failed with java.lang.NoClassDefFoundError: org/postgresql/Driver.

What you see​

Creating a connector on a worker that has not loaded its class:

The answer is HTTP 500, and the worker log holds the same exception.

HTTP 500
{"error_code":500,"message":"Failed to find any class that implements Connector and which name matches io.debezium.connector.postgresql.PostgresConnector, available connectors are: PluginDesc{klass=class org.apache.kafka.connect.mirror.MirrorCheckpointConnector, name='org.apache.kafka.connect.mirror.MirrorCheckpointConnector', version='3.2.0', encodedVersion=3.2.0, type=source, typeName='source', location='classpath'}, ..."}

The second place it appears is the status of a connector that exists while its plug-in does not. In the run, the plug-in was removed and the worker restarted:

The status call itself fails, with HTTP 500 and the message as its body:

json
{
"error_code": 500,
"message": "Failed to find any class that implements Connector and which name matches io.debezium.connector.postgresql.PostgresConnector, available connectors are: ..."
}

The same failure across versions​

The message has not changed. It is in the source at the 0.10.2.2, 0.11.0.0, 1.1.1, 2.0.1, 3.2.0, 3.6.0, 4.3.1 and 4.4.0 tags. What changed around it is where plug-ins come from and what the worker tells you:

Kafka ConnectWhat changedWhere it comes from
Before 0.11.0No plugin.path. Connector jars are loaded from the Java class pathKIP-146, source at 0.10.2.2
0.11.0plugin.path: each plug-in gets a class loader of its ownKIP-146, marked "Released: 0.11.0.0"
3.2GET /connector-plugins?connectorsOnly=false also lists converters and transformationsSource at 3.1.2 and 3.2.0
3.6plugin.discovery, the connect-plugin-path.sh tool, and the Failed to discover log linesKIP-898, marked "Released in 3.6.0", source at 3.6.0

How the worker finds plug-ins​

A worker builds its list of plug-ins once, when it starts. It looks on its own class path and in every folder named in plugin.path. The Kafka documentation says what each of those folders may hold: "directories immediately containing jars with plugins and their dependencies", single jars that carry their dependencies, or class files.

So each item directly inside a plugin.path folder becomes one plug-in with its own class loader:

Item directly inside a plugin.path folderWhat the worker makes of it
A folder of jarsOne plug-in, whose jars see each other
A jar on its ownOne plug-in, cut off from the jars next to it

When you create a connector, the worker looks the class name up in that list and nothing else. If the name is not there, it answers with this error and prints the list.

Versions on this page

The runs used Kafka Connect 4.3.1 on Java 21 with the Debezium PostgreSQL plug-in 3.7.1.Final, and Kafka Connect 3.2.0 on Java 11 with the Debezium PostgreSQL plug-in 1.9.7.Final. Each worker was the Kafka distribution started with connect-distributed.sh and one worker file. Unless an issue says otherwise, both versions gave the same result.

Issue 1: The plug-in is not on plugin.path​

The connect-distributed.properties file that ships with Kafka has plugin.path commented out. A worker started from it knows the connectors on its class path and no others. On both versions those were the three MirrorMaker connectors shown under What you see.

Fix: use the layout the Debezium documentation describes: extract the archive and "add the parent directory of the extracted plug-in(s)" to the plug-in path. The Debezium PostgreSQL archive unpacks to one folder:

/lab/plugins/debezium-connector-postgres/debezium-api-3.7.1.Final.jar
/lab/plugins/debezium-connector-postgres/debezium-connector-postgres-3.7.1.Final.jar
/lab/plugins/debezium-connector-postgres/postgresql-42.7.13.jar
/lab/plugins/debezium-connector-postgres/ (7 more jars)
properties
plugin.path=/lab/plugins

After a restart the worker logged the folder as one plug-in and listed the class:

INFO Loading plugin from: /lab/plugins/debezium-connector-postgres (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:277)
INFO Registered loader: PluginClassLoader{pluginLocation=file:/lab/plugins/debezium-connector-postgres/} (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:299)
INFO Added plugin 'io.debezium.connector.postgresql.PostgresConnector' (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:230)

Creating the connector returned HTTP 201, and the connector and its task reached RUNNING, on both versions.

Issue 2: plugin.path points at the jars​

With plugin.path=/lab/plugins/debezium-connector-postgres, one level too deep, the worker treated each jar as a separate plug-in. The class was not listed, and creating the connector failed with the error, on both versions.

The worker wrote a Loading plugin from: line for each jar and no warning or error about the plug-in:

INFO Loading plugin from: /lab/plugins/debezium-connector-postgres/debezium-connector-postgres-1.9.7.Final.jar (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:277)

Fix: point plugin.path at the parent folder and restart, as in Issue 1.

Issue 3: A half-installed plug-in​

Two jars were removed in turn from a correct layout. The two results differ.

A jar the connector class needs to load​

The removed jar was debezium-connector-common for the 3.7.1 plug-in and debezium-core for the 1.9.7 plug-in. The class was not listed, and creating the connector gave the error.

The worker logged no warning or error about the plug-in.

A jar it needs only when it runs​

Without the PostgreSQL driver jar the class was listed on both versions, so GET /connector-plugins looks right. Creating the connector then failed:

The call returned HTTP 500 with an HTML error page. The cause was only in the worker log:

Caused by: java.lang.NoClassDefFoundError: org/postgresql/Driver
Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver

Fix: install the whole archive again, for both cases. Compare the folder with the archive listing before you restart.

Issue 4: The worker was not restarted​

The plug-in was copied into an empty folder on plugin.path while the worker ran. Thirty seconds later the class was still not listed, on both versions.

Fix: restart the worker. After the restart the class was listed, and a connector that had been failing for want of the plug-in went back to RUNNING without being touched. The Debezium documentation says the same: "Restart your Kafka Connect process to pick up the new JARs."

In a cluster, install the plug-in and restart on every worker. Confluent's installation page puts it this way: "Each connector must be available on each worker." The lab has one worker and did not run this part.

Issue 5: The class name is wrong​

With the plug-in installed, a connector with connector.class set to io.debezium.connector.postgres.PostgresConnector got the same error, with HTTP 500 on 3.2.0 and HTTP 400 on 4.3.1. The package is postgresql. This time the list at the end of the message is the clue, because the right name is in it:

... available connectors are: PluginDesc{klass=class io.debezium.connector.postgresql.PostgresConnector, name='io.debezium.connector.postgresql.PostgresConnector', version='3.7.1.Final', encodedVersion=3.7.1.Final, type=source, typeName='source', location='file:/lab/plugins/debezium-connector-postgres/'}, ...

Kafka Connect also accepts the short name, PostgresConnector. The result depended on the plug-in version:

With the Debezium 1.9.7 plug-in, the connector was created and the connector and its task reached RUNNING.

Fix: use the full class name, copied from GET /connector-plugins.

Issue 6: The plug-in needs a newer Java​

This ran on Kafka Connect 3.2.0 only, because it needs a worker on an older Java than the plug-in. The Debezium 3.7.1 plug-in was put, correctly laid out, on the worker, which runs Java 11.0.15. The class was not listed, creating the connector gave the error, and the worker log held no warning or error about it.

The Debezium documentation states the requirement: "Note that Java 17 or later is required to run the Debezium connectors or Debezium UI." The jar shows it too:

Plug-in jarPostgresConnector.class starts withClass file version
debezium-connector-postgres-3.7.1.Final.jarcafebabe0000003d61
debezium-connector-postgres-1.9.7.Final.jarcafebabe0000003452

The Java Virtual Machine specification lists 61 for Java 17 and 55 as the highest version Java 11 reads. To read the version of a jar:

bash
unzip -p debezium-connector-postgres-3.7.1.Final.jar io/debezium/connector/postgresql/PostgresConnector.class | head -c 8 | xxd -p

Fix: use a plug-in version built for the worker's Java, or a worker on a newer Java. The same 3.7.1 archive loaded on the 4.3.1 worker, which runs Java 21, and the 1.9.7 plug-in loaded on the Java 11 worker.

Issue 7: service_load and a plug-in without a manifest​

From Kafka Connect 3.6 the worker can find plug-ins in two ways, and plugin.discovery chooses. The Kafka documentation says of the service_load setting: "Plugins which are incompatible with that mechanism may be unusable." The Debezium 1.9.7 plug-in has no META-INF/services manifest.

The setting does not exist on this version. The worker ignored it and listed the plug-in:

WARN The configuration 'plugin.discovery' was supplied but isn't a known config. (org.apache.kafka.clients.admin.AdminClientConfig:384)

Fix: add the manifests, or go back to the default.

bash
bin/connect-plugin-path.sh sync-manifests --plugin-path /lab/other-version

The tool answered All loadable plugins have accurate ServiceLoader manifests. After a restart, still with service_load, the class was listed. The documentation warns that the command "may alter the contents of the directories", so run it on a copy.

Setting plugin.discovery back to hybrid_warn is the other fix, and a plug-in release that ships its own manifests is the lasting one. The Debezium 3.7.1 plug-in has them.

Issue 8: plugin.path at the lib folder of a Confluent Hub archive​

Confluent Hub is now called Confluent Marketplace. Its archives have one more level than the Debezium ones, with the jars in a lib folder:

debezium-debezium-connector-postgresql-3.2.6-4/assets
debezium-debezium-connector-postgresql-3.2.6-4/doc
debezium-debezium-connector-postgresql-3.2.6-4/etc
debezium-debezium-connector-postgresql-3.2.6-4/lib
debezium-debezium-connector-postgresql-3.2.6-4/manifest.json

The rule is the same as in Issue 2. With plugin.path set to the lib folder, the class was not listed. Archive 3.2.6-4 was used on 4.3.1, and archive 2.5.4-3, with the same layout, on 3.2.0.

Fix: set plugin.path to the folder that contains debezium-debezium-connector-postgresql-3.2.6-4. The class was then listed, on both versions.

Or let the confluent-hub client do both steps. Run against a worker file with no plugin.path, it installed the connector and edited the file:

bash
confluent-hub install --no-prompt --component-dir /lab/hub-components \
--worker-configs /lab/worker.properties debezium/debezium-connector-postgresql:3.2.6-4
Downloading component Debezium PostgreSQL CDC Connector 3.2.6-4, provided by Confluent from Confluent Hub and installing into /lab/hub-components
Adding installation directory to plugin path in the following files:
/lab/worker.properties

On 4.3.1 the file then held plugin.path = /lab/hub-components, and after a restart the class was listed. On 3.2.0 the client stopped at the download with javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake, so this step is not verified there.

The client edits the files you name. A worker that takes its settings from somewhere else, such as environment variables of a container image, does not see the change.

Confluent's documentation says the client commands "are deprecated in Confluent Platform 7.6" and names confluent connect plugin install as the replacement. The lab ran the client and not the replacement.

Issue 9: A converter that is not installed​

Converters and transformations are plug-ins too, found the same way. This ran on Kafka Connect 4.3.1 only; the 3.2.0 image carries an Avro converter on its class path.

A connector that named io.confluent.connect.avro.AvroConverter on a worker without it was rejected:

HTTP 400
{"error_code":400,"message":"Connector configuration is invalid and contains the following 1 error(s):\nInvalid value io.confluent.connect.avro.AvroConverter for configuration value.converter: Class io.confluent.connect.avro.AvroConverter could not be found.\nYou can also find the above list of errors at the endpoint `/connector-plugins/{connectorType}/config/validate`"}

Fix: install the converter as a second folder under plugin.path, next to the connector, and restart. In the run the converter archive from Confluent Hub was unzipped there. GET /connector-plugins?connectorsOnly=false then listed the converter, and validating the same configuration returned no errors.

Confirm the diagnosis​

1. Ask the worker (all issues). Call the worker you send the connector to. The Kafka documentation notes that "the API only checks for connectors on the worker that handles the request".

bash
curl -s localhost:8083/connector-plugins
curl -s 'localhost:8083/connector-plugins?connectorsOnly=false'

The second form needs Kafka Connect 3.2 or later and adds converters and transformations (Issue 9). The answer is JSON. A worker with no plugin.path returned these classes, types and versions on 4.3.1 (Issue 1):

org.apache.kafka.connect.mirror.MirrorCheckpointConnector source 4.3.1
org.apache.kafka.connect.mirror.MirrorHeartbeatConnector source 4.3.1
org.apache.kafka.connect.mirror.MirrorSourceConnector source 4.3.1

If the class is listed and creating the connector still fails, see the driver case in Issue 3, and the short name in Issue 5. If the class is missing from a list that holds a similar name, see Issue 5.

2. Read what the worker treated as a plug-in (Issues 1, 2 and 8). At start-up it writes one Loading plugin from: line per plug-in, and the same block of the log shows the plugin.path it is using.

bash
docker logs <connect-container> 2>&1 | grep -E 'Loading plugin from|plugin.path = '

A path that ends in a folder is right. A path that ends in .jar for every jar of one connector means plugin.path is one level too deep.

3. On Kafka Connect 3.6 or later, ask the tool (Issues 3 and 7). It lists every plug-in under a path with two flags, isLoadable and hasManifest.

bash
bin/connect-plugin-path.sh list --plugin-path /opt/connect-plugins

Prevent it​

  • Keep one folder per plug-in under one parent, and set plugin.path to the parent. Do not copy jars from one plug-in folder into another.
  • After every install or upgrade, restart the workers and compare GET /connector-plugins on each of them with what you expect.
  • Build the worker image with its plug-ins inside, so that every worker has the same set.
  • Before upgrading a worker to Kafka Connect 3.6 or later, or setting plugin.discovery=service_load, run connect-plugin-path.sh list on the plug-in folder.
  • Use full class names in connector.class.
How OLake Go handles this

OLake Go does not run on Kafka Connect, so it has no worker, no plugin.path and no plug-ins to install. Its PostgreSQL connector, for example, "can be used within the OLake UI or run locally via Docker", as its page says.

References​