0

I am doing a PoC to connect Cassandra from my java8 application code. I am using apache Cassandra with java8

To start with I looked and started with https://github.com/lankydan/datastax-java-driver

Trying to connect my Cassandra cluster

when i download and try to connect the same to my C* cluster I am getting Caused by: java.net.UnknownHostException: 10.24.78.22,10.24.78.108,10.24.79.173

Updated **CassandraConfig**
.addContactPoints(host)

I updated **application.properties** file
cassandra.host=10.24.78.22,10.24.78.108,10.24.79.173
cassandra.cluster.name=My_Cluster
cassandra.port=9042
cassandra.keyspace=rrr_xxx

So what need to be fixed, and how to fix this issue?

BdEngineer
  • 2,929
  • 4
  • 49
  • 85
  • can you mention the nodetool status output and also check if you are able to telnet to 10.24.78.22 port : 9042 from your machine – Abhishek Garg Jul 19 '19 at 07:56
  • @AbhishekGarg thanks for reply there is no issue with IP , i am able to ping it and moreover I connected the same C* cluster with my Editor...so no issues with hosts. – BdEngineer Jul 19 '19 at 08:17

1 Answers1

3

the .addContactPoints function accepts an array of the strings, inet addresses, hosts, etc., while you're passing a one string with multiple addresses inside. You need somehow convert this string into array, or pass only one address.

if you already modifying the code, then it should be simply changed to

.addContactPoints(host.split(","))
Alex Ott
  • 80,552
  • 8
  • 87
  • 132
  • thank you. Its working... Unable to covert sql.Date to Cassandra Date while saving ... any help please ... https://stackoverflow.com/questions/57111413/codecnotfoundexception-codec-not-found-for-requested-operation-date-java – BdEngineer Jul 19 '19 at 11:20