1
votes

I am trying to access Cassandra database using Hector api 1.1-4 and i have authentication and authorization enabled in Cassandra . here is my code for creating cluster:

cluster = HFactory.getOrCreateCluster("Test Cluster", "localHost:9160", credentials);

but unfortunately it gives me error :

The method getOrCreateCluster(String, CassandraHostConfigurator, Map) in the type HFactory is not applicable for the arguments (String, String, Map)

1

1 Answers

1
votes

You're supplying the second parameter as a String and the error is telling you that you need to supply a CassandraHostConfigurator object. Build the object as:

CassandraHostConfigurator hostConfig = new CassandraHostConfigurator("localhost:9160");

And now try supplying the new parameters.

HFactory.getOrCreateCluster("Test Cluster", hostConfig, credentials);

p.s. the wiki one-lines this, so feel free to do the same.