Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-28263

Spark-submit can not find class (ClassNotFoundException)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • 2.4.3
    • None
    • Spark Shell, Spark Submit

    Description

      I try to run the Main class in my folder using the following code in the script:

       

      spark-shell --class com.navercorp.Main /target/node2vec-0.0.1-SNAPSHOT.jar --cmd node2vec ../graph/karate.edgelist --output ../walk/walk.txt 

      But it raises the error:

      19/07/05 14:39:20 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
      19/07/05 14:39:20 WARN deploy.SparkSubmit$$anon$2: Failed to load com.navercorp.Main.
      java.lang.ClassNotFoundException: com.navercorp.Main
      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:348)
      at org.apache.spark.util.Utils$.classForName(Utils.scala:238)
      at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:810)
      at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:167)
      at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:195)
      at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:86)
      at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:924)
      at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:933)
      at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

      I have jar file in my folder, this is the structure:

      1----node2vec
           2----node2vec_spark
                 3----main
                       4----resources
                       4----com
                              5----novercorp
                                     6----lib
                                            7----Main
                                            7----Node2vec
                                            7----Word2vec
           2----target
                  3----lib
                  3----classes
                  3----maven-archiver
                  3----node2vec-0.0.1-SNAPSHOT.jar       
           2----graph
                  3---karate.edgelist
           2----walk
                  3----walk.txt
      

      Also, I attach the structure of jar file:

      ```META-INF/
      META-INF/MANIFEST.MF
      log4j2.properties
      com/
      com/navercorp/
      com/navercorp/Node2vec$.class
      com/navercorp/Main$Params$$typecreator1$1.class
      com/navercorp/Main$$anon$1$$anonfun$11.class
      com/navercorp/Word2vec$.class
      com/navercorp/Main$$anon$1$$anonfun$8.class
      com/navercorp/Node2vec$$anonfun$randomWalk$1$$anonfun$8.class
      com/navercorp/Node2vec$$anonfun$indexingGraph$4.class
      com/navercorp/Node2vec$$anonfun$initTransitionProb$1.class
      com/navercorp/Main$.class
      com/navercorp/Node2vec$$anonfun$loadNode2Id$1.class
      com/navercorp/Node2vec$$anonfun$14.class
      com/navercorp/Node2vec$$anonfun$readIndexedGraph$2$$anonfun$1.class
      ```

      Could someone give me the advice on how to connect Main class?

      Attachments

        Activity

          People

            Unassigned Unassigned
            Cvanzy Zhiyuan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 10m
                10m
                Remaining:
                Remaining Estimate - 10m
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified