java.lang.NoClassDefFoundError when updating Inbound Kafka Connector

The Aerospike Knowledge Base has moved to https://support.aerospike.com. Content on https://discuss.aerospike.com is being migrated to either https://support.aerospike.com or https://docs.aerospike.com. Maintenance on articles stored in this repository ceased on December 31st 2022 and this article may be stale. If you have any questions, please do not hesitate to raise a case via https://support.aerospike.com.

java.lang.NoClassDefFoundError when updating Inbound Kafka Connector

Problem Description

When the Aerospike Kafka Inbound Connector is updated to version 2.2 or higher, the update fails with the following error:

java.lang.NoClassDefFoundError:
io/confluent/kafka/schemaregistry/client/SchemaRegistryClient
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at org.apache.kafka.common.config.ConfigDef.parseType(ConfigDef.java:720)
at org.apache.kafka.common.config.ConfigDef.parseValue(ConfigDef.java:475)
at org.apache.kafka.common.config.ConfigDef.parse(ConfigDef.java:468)
at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:108)
at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:129)

The class exists on the system.

Explanation

From version 2.2 of the Inbound Connector the Avro converter was removed from the release. The converter had previously been present in the release artifact but was an unused dependency (unless if specified as a converter in the configuration). The Aerospike connector is converter agnostic as per convention. Any converter dependency should be setup external to the connector.

Solution

The JAR containing the AvroConverter needs to be available in one of the directories that is listed on the Connect worker’s plugin.path configuration properties.

Notes

Applies To

Kafka Connector 2.2 and later

Keywords

KAFKA CONNECTOR SINK INBOUND NO CLASS

Timestamp

November 2021