How to solve problems with your Kafka connector

Sean Boyd Avatar

Share with

This post contains errors you may encounter while using an IBM Event Streams Kafka connector. An appropriate solution is provided.

Problems

ProblemProblem
ClassNotFoundException

ClassNotFoundException

Problem description

You may encounter a ClassNotFoundException when you run your IBM Event Streams Kafka ‘MQ source’ connector for the first time. The exact reason may not be obvious at first, other than it is clear a class is missing.

ClassNotFoundException
2025-03-17 14:38:36,229 ERROR [mq-source]task-0] Failed to start task mq-source-0 (org.apache.kafka.
connect.runtime.Worker) [StartAndStopExecutor-connect-1-6]
java. lang.NoClassDefFoundError: javax. jms. JMSRuntimeException
at java.base/java.lang.Class.forNameImpl(Native Method)
at java.base/java.lang.Class.forName(Class.java:429)
at org.apache.kafka. common.config.ConfigDef.parseType(ConfigDef.java:738)
at org. apache.kafka. common.config.ConfigDef.parseValue(ConfigDef.java:493)
at org. apache.kafka. common.config.ConfigDef.parse(ConfigDef.java:486)
at org. apache.kafka. common.config.AbstractConfig .< init>(AbstractConfig.java:112)
at org. apache.kafka. common.config.AbstractConfig .< init>(AbstractConfig.java:145)
at org.apache.kafka.connect.runtime. TaskConfig .< init>(TaskConfig.java:51)
at org. apache.kafka. connect.runtime.Worker. startTask(Worker. java:622)
at org. apache.kafka.connect.runtime.Worker. startSourceTask(Worker.java:559)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder.startTask(DistributedHerder.
java:1902)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder.
lambda$getTaskStartingCallable$35(DistributedHerder.java:1919)
at java.base/java.util.concurrent.FutureTask.run(FutureTask. java:264)
at java.base/java.util.concurrent. ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent. ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang. Thread.run(Thread. java:857)
Caused by: java.lang. ClassNotFoundException: javax. jms. JMSRuntimeException
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:574)
at java.base/java.lang.ClassLoader.loadClassHelper(ClassLoader. java:1197)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1112)
at org. apache.kafka.connect.runtime.isolation.PluginClassLoader.loadClass(PluginClassLoader.
java: 124)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1095)
16 more

In my case, the problem was caused by me using an IBM MQ source connector jar file that was missing the dependencies.

In the latest iteration of the IBM Event Streams documentation there is no list showing the dependencies. There is only a brief mention to include the dependencies. I suspect this is due to the fact that the later connector jar files contain the dependencies.

If you, like me, used an older jar file and came across the latest documentation you may be at a loss. It wasn’t until viewed and older version of the online documentation that I found the dependencies.

Solution

The recommendation is to always use the latest connector. In this case the latest connector contains a jar file that includes all the dependencies (kafka-connect-mq-source-2.3.0-jar-with-dependencies.jar).

Rebuild the Kafka Connect image with the latest jar that includes all the dependencies. Refer here for a sample structure you can use to rebuild the image.

If you cannot use the latest jar that includes the dependencies, you’ll need to download the dependencies and add these to your Kafka Connect image.

Rebuild the image with the dependencies. The dependencies can be downloaded from Maven. To see the correct structure, you can refer here.

The older IBM online documentation shows the dependencies as follows.

Last updated: 8 April 2025

Sean Boyd Avatar

Leave a Reply

Your email address will not be published. Required fields are marked *