I had to build a jar
from my scala
code using sbt
:
sudo sbt package
It used my build file:
name := "PSG CCD"
version := "1.0"
scalaVersion := "2.11.8"
resolvers += "Spark Packages Repo" at "http://dl.bintray.com/spark-packages/maven"
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "2.2.0",
"org.apache.spark" %% "spark-sql" % "2.2.0",
"org.apache.spark" %% "spark-streaming" % "2.2.0",
"neo4j-contrib" % "neo4j-spark-connector" % "2.0.0-M2"
)
I also built the jar
just fine. Then, I transfer it via FTP to my spark
server and do a spark-submit
:
spark-submit --class "PSGApp" --master local[4] psg_ccd.jar
I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/neo4j/spark/Neo4j
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:739)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:180)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:205)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:119)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.neo4j.spark.Neo4j
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[truncated, 10 more messages]
So even though I have the neo4j-spark-connector
in the dependency file, it doesn't seem to find it when I run it through spark
. Now this spark
is ran on a different machine than I built the jar
from scala
on. Does this matter? Is there a folder of libs I need to copy and drop somewhere?
I am guessing the library information of the neo4j
spark
connection dependency was not built into the jar
I am trying to run.
Maybe I am missing a switch to force that?