Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

Error: Cannot load main class from JAR ...... Please specify a class through --class.

New Contributor

i'm studing AirFlow, Kafka, Spark and Docker.


I'm trying to run this project here


But my task is always returning an error: 

Error: Cannot load main class from JAR org.apache.spark:spark-sql-kafka-0-10_2.11:2.3.1 with URI org.apache.spark. Please specify a class through --class.

This is my docker compose

And here is my airflow docker.


What am i doig wrong? 


Community Manager

@gizelly Welcome to the Cloudera Community!

To help you get the best possible solution, I have tagged our Kafka experts @paras and @rki_  who may be able to assist you further.

Please keep us updated on your post, and we hope you find a satisfactory solution to your query.


Diana Torres,
Community Moderator

Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:

Super Collaborator

Hi @gizelly 


Based on the above exception, spark-sql-kafka library is not added to the classpath. You need to add that jar to class path or build the fat jar.


For your spark-submit command add the jar using following command:

./bin/spark-submit \
--packages org.apache.spark:spark-sql-kafka-0-10_2.11:2.3.1 ...

Super Collaborator

Hi @gizelly 


Have you tried above solution and its worked? If yes, please accept as Solution. It will useful to other members.