Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

191036020_173041 avatar image
191036020_173041 asked ·

Getting NoClassDefFoundError using Java 11 with Spark connector 3.0.0-beta

Hello team,

I am facing an issue when using Spark Cassandra Connector 3.0, here is the details,

Cassandra version: 3.11.6

OpenJDK 11

Spark 3.0.0

When I tried to use Spark Cassandra Connector 3.0 beta version, I got an error

java.lang.NoClassDefFoundError (com/datastax/spark/connector/util/Logging)
spark-cassandra-connector
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

jaroslaw.grabowski_50515 avatar image
jaroslaw.grabowski_50515 answered ·

Hi!

You probably don't include dependencies of Spark Cassandra Connector in your classpath. The main artifact (https://repo1.maven.org/maven2/com/datastax/spark/spark-cassandra-connector_2.12/3.0.0-beta/) depends on the driver module (https://repo1.maven.org/maven2/com/datastax/spark/spark-cassandra-connector-driver_2.12/3.0.0-beta/) and few other artifacts.


You could use one of these approaches to get rid of the error:

* use SCC with --packages Spark parameter (in this case Spark is responsible for resolving SCC and its dependencies),

* build a fat jar for your app with SCC included (with dependencies)

* use SCC assembly jar (it has all the dependencies assembled into one jar - https://repo1.maven.org/maven2/com/datastax/spark/spark-cassandra-connector-assembly_2.12/3.0.0-beta/)

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Erick Ramirez avatar image
Erick Ramirez answered ·

This may be a classpath issue but it's hard to say without the full error message and the full stack trace.

I'm going to reach out to the Analytics team here at DataStax and get them to respond to this question. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.