Reputation: 1211
i want to do a connection with Cassandra with java class.But its not working .Here is my code ..
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;
class CassandraConnection {
public static void main(String[] args) {
String serverIp = "166.78.10.41";
String keyspace = "gamma";
CassandraConnection connection;
Cluster cluster = Cluster.builder()
.addContactPoints(serverIp)
.build();
Session session = cluster.connect(keyspace);
String cqlStatement = "SELECT * FROM TestCF";
for (Row row : session.execute(cqlStatement)) {
System.out.println(row.toString());
}
}
}
this is the error log..
Total time: 0.883s Finished at: Wed Jun 05 15:54:02 IST 2013
Failed to execute goal on project CassandraConnection: Could not resolve dependencies for project com.mycompany:CassandraConnection:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: com.datastax.cassandra:cassandra-driver-parent:jar:1.0.0, org.specs2:scalaz-effect_2.11.0-SNAPSHOT:jar:7.0.1-SNAPSHOT, org.scalaz:scalaz-effect_2.9.3:jar:7.1.0-SNAPSHOT: Failure to find com.datastax.cassandra:cassandra-driver-parent:jar:1.0.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Upvotes: 0
Views: 5057
Reputation: 1121
To be more specific, enter something like this in the section of the pom file:
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>2.0.0-rc2</version>
</dependency>
Upvotes: 1
Reputation: 528
Adding to above from Sajan it could be possible that the downloaded file in your local repository is corrupt so you can follow step 2 of his suggestions.
Upvotes: 0
Reputation: 11487
Am not a cassandra expert, but
Just by looking at the error, it seems that maven cannot resolve the cassandra
related dependencies
SOLUTION:
http://repo.maven.apache.org/maven2
) casandra dependencies are present, which indicate that you may have problem in connecting the maven repo
from your machine it could be firewall issue.maven repo
, download the file manually and install the file manually to your local repo (http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html
).Upvotes: 2