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

lambda avatar image
lambda asked ·

Why am I getting the error "There are no contact points in the given set of hosts"?

Hi everyone.
This is my situation. I'm trying to do some integration tests with Testcontainers library.
I use Micronaut also. Testcontainers by default mapping exposed port of cassandra container to some random port, so I use some feature of Micronaut that help me intercept this and update my application.yaml file where store settings such as cassandra.host and cassandra.port which I use to configure JavaSparkContext(they are correctly update). When I try to do writes to or reads from Cassandra like in this tutorial Java Api I receive exception "There are no contact points in the given set of hosts."

SparkConf conf = new SparkConf(true);
conf
  .setAppName("test")
  .setMaster("local[*]")
  .set("spark.cassandra.connection.host", getCassandraHost())
  .set("spark.cassandra.connection.port", getCassandraPort().toString());
sparkContext = new JavaSparkContext(conf);
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.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

You've provided very limited information but the error means exactly what it states -- that there were no contact points provided to the Spark connector.

You'll need to debug your code to determine what hosts are getting returned by the getCassandraHost() method. 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.