Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

scala - Spark - Error: Failed to load class - spark-submit

I create sbt project with Intellij and build Artifacts to jar file. I put jar file to server and submit, but I got this error:

spark-submit --master spark://master:7077 --class streaming_process spark-jar/spark-streaming.jar

Error: Failed to load class streaming_process.
21/01/23 04:41:32 INFO ShutdownHookManager: Shutdown hook called
21/01/23 04:41:32 INFO ShutdownHookManager: Deleting directory /tmp/spark-982e8fe3-9421-45bd-aced-e46c4d756054

My code

// Code Block 2 Starts Here
    val spark = SparkSession.builder
      .master("spark://master:7077")
      .appName("Stream Processing Application")
      .getOrCreate()

    spark.sparkContext.setLogLevel("ERROR")
    // Code Block 2 Ends Here

    // Code Block 3 Starts Here
    // Stream meetup.com RSVP Message Data from Kafka
    val meetup_rsvp_df = spark.readStream
      .format("kafka")
      .option("kafka.bootstrap.servers", kafka_bootstrap_servers)
      .option("subscribe", kafka_topic_name)
      .option("startingOffsets", "latest")
      .load()

You can see my project image:

enter image description here

question from:https://stackoverflow.com/questions/65853202/spark-error-failed-to-load-class-spark-submit

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

JVM can't find the jar which contains streaming_process class. Please use --jars spark-jar/spark-streaming.jar option.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...