This problem is old as Apache Spark itself, but still neither of solutions helped me. I have following class declaration:
object Main {
def main(args: Array[String]): Unit = {
...
}
Class reference is org.griat.rcse.Main (ctrl+shift+alt+c in IntelliJ), the same stays in pom.xml
:
<groupId>org.griat.rcse</groupId>
The way I try to run it:
spark-submit --master yarn --deploy-mode client --class org.griat.rcse.Main Glonass112-1.0-SNAPSHOT.jar
And once it has worked, but caught an exception in code. After I fixed it, I clean
ed and package
d it. Though pom.xml
didn't change (as well as paths and class names), it stopped submitting to Spark, showing ClassNotFoundException
:
java.lang.ClassNotFoundException: org.griat.rcse.Main
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
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 also added maven-jar-plugin
, not that it would help:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.griat.rcse.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
What is the source of this black magic and how can I handle it?