Dear Wiki user, You have subscribed to a wiki page or wiki category on "Cassandra Wiki" for change notification.
The "RunningCassandraInEclipse" page has been changed by RogerSchildmeijer. http://wiki.apache.org/cassandra/RunningCassandraInEclipse?action=diff&rev1=1&rev2=2 -------------------------------------------------- Eclipse is open source. Download Eclipse from http://www.eclipse.org/downloads/. There is no need for the Enterprise Edition (EE) version of Eclipse. Hence "Eclipse IDE for Java Developers" is good enough. - Cassandra is using Git and Subversion for version control. In this tutorial we will checkout Cassandra from subversion. To be able to do this we need a subversion plugin for Eclipse, because there is no native svn (or git) support. Feel free to use your favorit Eclipse Subversion plugin. Though this tutorial will use the Subclipse (http://subclipse.tigris.org/) Ecplise Subversion plugin. + Cassandra is using Git and Subversion for version control. In this tutorial we will checkout Cassandra from Subversion. To be able to do this we need a Subversion plugin for Eclipse (there is no native svn (or git) support in Eclipse). Feel free to use your favorite Eclipse Subversion plugin. Though, this tutorial will use the Subclipse (http://subclipse.tigris.org/) Ecplise Subversion plugin. + = Setup Cassandra = + + Preconditions: JDK6, Ant (http://ant.apache.org/), Eclipse + Subversion plugin + + Start Eclipse and open perspective "SVN Repository Exploring" (Window -> Open Perspective -> Other... -> SVN Repository Exploring) + (If you dont have perspective "SVN Repository Exploring" you need to install an Eclipse Subversion plugin, eg. Subclipse or Subversive) + + {{attachment:WindowOpenPerspectiveOther-1.png}} + + Right mouse click in the "SVN Repositories" view, choose New -> Repository Location... + Enter https://svn.apache.org/repos/asf/cassandra/ as the Url and the press "Finished". Expand the directory and right mouse click on 'trunk' and choose 'checkout'. + + {{attachment:SVNCheckout-3.png}} + + + Make sure that the first radio button is "Check out as a project configured using the New Project wizard" and press "Finish". + + {{attachment:CheckoutFromSVN-4.png}} + + Select "Java" -> "Java Project" + + {{attachment:NewProject-5.png}} + + Pick an appropriate project name (hint cassandra). Press "Finish" without do any changes. If the IDE asks you to open the "Java Perspective" I recommend you you to do so. Also if the "Confirm Overwrite" dialog appears just accept. + + {{attachment:NewJavaProject-6.png}} + + After the following steps your project workspace should look something like this: + + {{attachment:InitialEclipseProjectWorkspace-7.png}} + + As you might have noticed (currently) Eclipse is mad and we need to perform some additional steps (generate CLI (Command Line Interface) grammar, avro, thrift and add some third party dependencies to the Eclipse build path (java classpath)) to fix this. + + Right click on the build.xml (in your project root) -> Run As -> Ant Build + This will do a whole lot of good things, eg. generate the CLI grammar with ANTLR, generate avro and thrift code. + + Next thing you want to do is to add all the needed third party libraries to the build path. + Expand the lib/ folder and find a bunch of jar files. Shift select all of them and right mouse click and choose "Build Path" -> "Add to Build Path". + This will force Eclipse do update the entire workspace, so please be patient. Some of the errors should also have disappeared by now (not all though). + + {{attachment:AddToBuildPath-9.png}} + + The final step is to add the generate Java code to the Eclipse build path. Expand and select interface/thrift/gen-java, right click -> "Build Path" -> "Use as Source Folder". Do the same for interface/avro/gen-java and src/gen-java. + + {{attachment:AddThriftToBuildPath-10.png}} + + Now the errors should be gone and you are ready to create a run/debug configuration for cassandra. + + Click "Run" -> "Run Configurations...". Select org.apache.cassandra.thrift.CassandraDaemon as you Main class, make sure that your cassandra project is select in the "Project" field. + Under the Arguments tab you can specify VM arguments. Below is my complete Vm arguments list: + + -Dstorage-config=/Users/schildmeijer/Documents/workspace/cassandra/conf/ + -Xmx1G + -XX:TargetSurvivorRatio=90 + -XX:+AggressiveOpts + -XX:+UseParNewGC + -XX:+UseConcMarkSweepGC + -XX:+CMSParallelRemarkEnabled + -XX:+HeapDumpOnOutOfMemoryError + -XX:SurvivorRatio=128 + -XX:MaxTenuringThreshold=0 + -Dcom.sun.management.jmxremote.port=8080 + -Dcom.sun.management.jmxremote.ssl=false + -Dcom.sun.management.jmxremote.authenticate=false" + + + Make sure to change the storage-config property so it defines the path to your storage-conf.xml file. + + + That should be it. After running the newly created run configuration you should see something like this in the console view. + + DEBUG 22:01:25,524 Estimating compactions for HintsColumnFamily + DEBUG 22:01:25,524 Estimating compactions for Migrations + DEBUG 22:01:25,525 Estimating compactions for Schema + DEBUG 22:01:25,526 Checking to see if compaction of LocationInfo would be useful + DEBUG 22:01:25,526 Checking to see if compaction of HintsColumnFamily would be useful + DEBUG 22:01:25,527 Checking to see if compaction of Migrations would be useful + DEBUG 22:01:25,527 Checking to see if compaction of Schema would be useful + INFO 22:01:25,537 Saved Token found: 1816769162446994796948805497871322369 + INFO 22:01:25,537 Saved ClusterName found: Test Cluster + INFO 22:01:25,568 Starting up server gossip + DEBUG 22:01:25,597 attempting to connect to /127.0.0.1 + INFO 22:01:25,691 Binding thrift service to localhost/127.0.0.1:9160 + + + Try running the cassandra-cli as per CassandraCli, and you should be able to connect to localhost/9160. + + + + + + + +