Reputation: 1133
I set up the Hector API for Cassandra Database in Eclipse. I got errors about SLF4J [some logging utility]. I've spent the last [almost] 2 hours debugging errors with it. After importing the packages, I get
Exception in thread "main" java.lang.ExceptionInInitializerError at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265) at me.prettyprint.cassandra.service.AbstractCluster.(AbstractCluster.java:44) at me.prettyprint.cassandra.service.ThriftCluster.(ThriftCluster.java:21) at me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:196) at me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:143) at me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:132) at CassandraInterface.main(CassandraInterface.java:7) Caused by: java.lang.UnsupportedOperationException: This code should have never made it into the jar at org.slf4j.impl.StaticLoggerBinder.(StaticLoggerBinder.java:63) at org.slf4j.impl.StaticLoggerBinder.(StaticLoggerBinder.java:44) ... 11 more
Is there any Cassandra database API that I can just drop into my Eclipse project and begin using out of the box, without having to install, configure, and debug additional 3rd-party software?
Also: I don't have Maven installed. The best thing would be a single JAR file or folder of JAR files/java sources.
EDIT: I have the Hector API installed and my program compiles without errors, but now I get a runtime error
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.thrift.meta_data.FieldValueMetaData.<init>(BZ)V
at org.apache.cassandra.thrift.ColumnParent.<clinit>(ColumnParent.java:128)
at me.prettyprint.cassandra.service.template.AbstractColumnFamilyTemplate.<init>(AbstractColumnFamilyTemplate.java:63)
at me.prettyprint.cassandra.service.template.ColumnFamilyTemplate.<init>(ColumnFamilyTemplate.java:39)
at me.prettyprint.cassandra.service.template.ThriftColumnFamilyTemplate.<init>(ThriftColumnFamilyTemplate.java:38)
at CassandraInterface.main(CassandraInterface.java:66)
I require any combination of .java, .class, or .jar files that I can just drop into my project without requiring Maven or XML file/directory configuration of any kind. Just something simple that does what it advertises.
Upvotes: 0
Views: 3467
Reputation: 1133
I figured it out.
HOW TO USE HECTOR WITHOUT MAVEN:
Download Hector from Github at https://github.com/rantav/hector/downloads
Now you need TBase and a bunch of other files. Get the jar file at http://www.java2s.com/Code/Jar/l/Downloadlibthrift060jar.htm
Unzip all of the downloads and put all of the JARs on your build path.
Start coding.
Upvotes: 0
Reputation: 7001
As you're using Eclipse, why not use the built-in maven functionality? This would allow you to:
"...just drop into my Eclipse project and begin using out of the box, without having to install, configure, and debug additional 3rd-party software".
Place the following into your pom.xml:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>me.prettyprint</groupId>
<artifactId>hector-core</artifactId>
<version>1.0-4</version>
</dependency>
Your code should then work.
Strongly encourage you to look into Why maven? What are the benefits?
Finally, if you're unwilling to go the easy and fairly standard road, you can follow Nick's suggestion: https://github.com/rantav/hector/downloads and download the tar.gz that contains all of the jar's and add them to your classpath.
Upvotes: 3
Reputation: 24635
Netflix has created client for Cassandra and it seems to be better than Hector and it is also supported by big company. Just drop Maven dependency to your pom.xml and then you can try some examples form their wiki pages.
https://github.com/Netflix/astyanax
Upvotes: 0