cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

java.lang.ClassNotFoundException: Failed to find data source: org.neo4j.spark.DataSource

Hello
I am trying to connect neo4j with apache spark
my current neo4j version is 4.2.3, apache spark - 2.4.7 , Scala- 2.11.12, my neo4j connector jar file version-neo4j-connector-apache-spark_2.12-4.0.0.jar

After getting the requirement I have tried to connect neo4j with my apache spark
and got

java.lang.ClassNotFoundException: Failed to find data source: org.neo4j.spark.DataSource. Please find packages at Third-Party Projects | Apache Spark
at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:675)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:213)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:186)
... 37 elided
Caused by: java.lang.ClassNotFoundException: org.neo4j.spark.DataSource.DefaultSource
at scala.reflect.internal.util.AbstractFileClassLoader.findClass(AbstractFileClassLoader.scala:62)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$20$$anonfun$apply$12.apply(DataSource.scala:652)

from documentation I have tried

spark-shell --jars neo4j-connector-apache-spark_2.114.0.0.jar
the shell was running well
when I was going to write the sample code in Jupiter notebook SPYLON kernel
the error occcured. Please help me to figure out the problem . I have put the jar file in spark/bin/jars tooo

2 REPLIES 2

I have tried the pre- relelease jar as well which was posted in

neo4j-connector-apache-spark_2.11_2.4-4.0.1-pre1.jar
but same issue is occuring

I faced the same issue. Using the Jar from Maven, Github releases - always the identical error: Failed to find data source: org.neo4j.spark.DataSource. And indeed, the provided jar doesn't contain that class.

However, if you use the Jars provided at https://neo4j.com/product/connectors/apache-spark-connector/, the DataSource is contained and it works.