Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-21-2021 02:16 PM
I follow the steps in (Quickstart - Neo4j Spark Connector) and use the following package:
$SPARK_HOME/bin/spark-shell --packages neo4j-contrib:neo4j-connector-apache-spark_2.12:4.0.1_for_spark_3
Now, in spark shell, when I try to execute this (mentioned in the same site):
import org.apache.spark.sql.{SaveMode, SparkSession}
val spark = SparkSession.builder().getOrCreate()
val df = spark.read.format("org.neo4j.spark.DataSource")
.option("url", "bolt://localhost:7687")
.option("authentication.basic.username", "neo4j")
.option("authentication.basic.password", "neo4j")
.option("labels", "Person")
.load()
The following error occur:
java.lang.NoClassDefFoundError: org/apache/spark/sql/sources/v2/ReadSupport
What shall I do to fix the problem?
01-30-2023 09:44 AM
It may be related to the combination of scala, connector and spark versions you are running - if they dont match exactly you will get an error
neo4j-contrib:neo4j-connector-apache-spark_2.12:4.0.1_for_spark_3
The jars are named like so JARs are named in the form: neo4j-connector-apache-spark_${scala.version}_${connector.version}_for_${spark.version}
From the jar you are using, you would need to have scala 2.12, connector 4.0.1 and spark 3 or above. If you have a different combination of versions then you will get an error. Try using a different jar that supports the combination you have https://neo4j.com/docs/spark/current/overview/
All the sessions of the conference are now available online