GKP
GKP

Reputation: 1087

Apache Ignite Kafka Streamer not working , getting java.lang.NoClassDefFoundError: Could not initialize class

Followed the instructions mentioned here : https://ignite.apache.org/docs/latest/extensions-and-integrations/streaming/kafka-streamer

But still getting following error :

WorkerSinkTask{id=my-ignite-sink-connector-1} Task threw an uncaught and unrecoverable exception. Task is being killed and will not recover until manually restarted. Error: Could not initialize class org.apache.ignite.stream.kafka.connect.IgniteSinkTask$StreamerContext$Holder (org.apache.kafka.connect.runtime.WorkerSinkTask:609)
java.lang.NoClassDefFoundError: Could not initialize class org.apache.ignite.stream.kafka.connect.IgniteSinkTask$StreamerContext$Holder
    at org.apache.ignite.stream.kafka.connect.IgniteSinkTask$StreamerContext.getStreamer(IgniteSinkTask.java:197)
    at org.apache.ignite.stream.kafka.connect.IgniteSinkTask.put(IgniteSinkTask.java:118)
    at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:581)
    at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:333)
    at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:234)
    at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:203)
    at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:188)
    at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:243)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

Upvotes: 0

Views: 343

Answers (1)

Milan Masek
Milan Masek

Reputation: 21

To resolve the issue, it should be enough to add the plugin path to the Kafka Connect properties. After that, the plugin is loaded and the class is accessible. Make sure you see the "Added plugin" message in the Kafka Connect log.

In your case, the message "java.lang.NoClassDefFoundError: Could not initialize class org.apache.ignite.stream.kafka.connect" relates to the class from the ignite-kafka-ext-1.0.0.jar. Double check than, the plugin.path is correctly set.

In my setup, I have distributed deployment of Kafka 3.2 (Confluent Platform 7.2). Configuration:

$ cat /etc/kafka/connect-distributed.properties .. plugin.path=/usr/share/java,/usr/share/java/ignite-kafka-connector-ignite-2.14.0 ..

It appears as follows in the log:

INFO Loading plugin from: /usr/share/java/ignite-kafka-connector-ignite-2.14.0 (org.apache.kafka.connect.runtime.isolation.Delegating ClassLoader:277) [2023-05-05 08:50:07,984] INFO Registered loader: PluginClassLoader{pluginLocation=file:/usr/share/java/ignite-kafka-connector-ignite-2.14.0/} (org.apache.kafk a.connect.runtime.isolation.DelegatingClassLoader:299) [2023-05-05 08:50:07,984] INFO Added plugin 'org.apache.ignite.stream.kafka.connect.IgniteSinkConnector' (org.apache.kafka.connect.runtime.isolation.Delegating ClassLoader:230) [2023-05-05 08:50:07,985] INFO Added plugin 'org.apache.ignite.stream.kafka.connect.IgniteSourceConnector' (org.apache.kafka.connect.runtime.isolation.Delegati ngClassLoader:230)

There are other Ignite related classes though, which have to be accessible on a classpath to make sink/source connector tasks fully working.

Upvotes: 0

Related Questions