Wednesday, March 4, 2015

Getting started with Cassandra Development in Eclipse (BEWARE of jdk8_40_ea, NoClassDefFoundError: ExtendedPlatformComponent)

I finally got back around to getting my environment setup for Cassandra development.  I ran into one snag, and couple things have changed so I figured I would capture the experience here.

Fork and Build

First, fork and clone from here:

Then run,

$> ant generate-eclipse-files

Eclipse Setup & Run Configuration

Then from Eclipse,
File -> Import -> Existing Projects into Workspace...

Navigate to your cassandra folder, and import the project.

Now, configure the run with:

Run Configurations -> Java Application -> Right-Click -> New

Main class:

Then use the following VM arguments:
-Dcassandra.config=file:///Users/bone/git/boneill42/cassandra/conf/cassandra.yaml -Dcassandra.storagedir=/tmp/cassandra -Dcassandra-foreground=yes

The gotcha: Make sure you are running jdk8_40 and NOT jdk8_40_ea!!!

If you are still running early access (_ea), you may see:
java.lang.NoClassDefFoundError: sun/management/ExtendedPlatformComponent


Next, it's useful to configure logging.  Cassandra changed from log4j to logback.  You can find the logback configuration in test/conf (logback-test.xml).

If you want to see DEBUG and/or INFO messages, edit this file and change the STDOUT element to:

  <appender name="STDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">

After that, you are good to go.  Click run, and you should have a live Cassandra in Eclipse


Daharewa Gureya said...

I have been looking how to set up and debug Cassandra in Eclipse and this Post just saved me big times...Thank you for posting!!

Anna said...

Great and Useful Article.

Online Java Training

Java Online Training India

Java Online Course

Java EE course

Java EE training

Best Recommended books for Spring framework

Java Interview Questions

Java Course in Chennai

Java Online Training India

Yash said...

Thank you for your feedback. We're glad you enjoyed the post. Feel free to share it with others you think may benefit from this information.

Cassandra Training in Chennai