I am running a Strimzi KafkaConnect cluster which loads a custom transformer to apply a SMT to our messages. The .jar is within the image and loaded by Strimzi KafkaConnect cluster (appears in logs):
Dockerfile line:
FROM quay.io/strimzi/kafka:0.29.0-kafka-3.0.1
USER root:root
RUN mkdir -p /opt/kafka/plugins
COPY --from=unpacker /unpack/kafka-connect-aws-s3 /opt/kafka/plugins #this is the lenses.io connector and works fine
COPY ./<FILE>.jar /opt/kafka/plugins #<FILE>.jar is downloaded locally by pipeline.
USER 1001
(I have a connector also within the /opt/kafka/plugins directory and that is picked up by KafkaConnect fine)
The error I see is:
Message: PUT /connectors/<NAME>/config returned 400 (Bad Request): Connector configuration is invalid and contains the following 2 error(s):
Invalid value <CLASS> for configuration transforms.<NAME>.type: Class <CLASS> could not be found.
Invalid value null for configuration transforms.<NAME>.type: Not a Transformation
However when I check within the image itself the file is there and the class appears to be there:
unzip -l /opt/kafka/plugins/<FILE>.jar | grep <CLASS>
1333 07-31-2023 09:49 <CLASS>$Companion.class
7990 07-31-2023 09:49 <CLASS>.class
Strimzi KafkaConnect logs:
k logs kafka-topics-backup-aws-connect-9f564bdcb-5qnp6 | grep <FILE>.jar
2023-08-30 13:51:49,301 INFO Loading plugin from: /opt/kafka/plugins/<FILE>.jar (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader) [main]
2023-08-30 13:51:49,973 INFO Registered loader: PluginClassLoader{pluginLocation=file:/opt/kafka/plugins/<FILE>.jar} (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader) [main]
The relevant parts of YAML for the KafkaConnectors:
spec:
class: io.lenses.streamreactor.connect.aws.s3.sink.S3SinkConnector
tasksMax: 1
config:
topics: "<NAME>"
connect.s3.kcql: <KCQL_STRING>
connect.s3.padding.strategy: LeftPad
connect.s3.padding.length: 8
connect.s3.vhost.bucket: true
transforms: "<NAME>"
transforms.<NAME>.type: "<CLASS>"
I was expecting that when I create KafkaConnectors using the above transform that they would load the class and work.
The issue I had was that I was using Strimzi 0.29.0 (with Kafka 3.0.1) and the Transformer was being built in Java17. Once I changed the Transformer to Java11 it was located by KafkaConnect and used