views:

132

answers:

3

Followed the steps to install the apache-cassandra latest build. Upon first startup (./cassandra -f), I get this:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/cassandra/thrift/CassandraDaemon Caused by: java.lang.ClassNotFoundException: org.apache.cassandra.thrift.CassandraDaemon at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334) Could not find the main class: org.apache.cassandra.thrift.CassandraDaemon. Program will exit.

I exported the JAVA_HOME path, etc. What am I doing wrong? I should note that I am on an Ubuntu Lucid machine.

A: 

If using Ubuntu (Lucid), use the tutorial here: http://dustyreagan.com/installing-cassandra-on-ubuntu-linux/, which is based on the debian package. Building from Git didn't work.

A: 

This answer may help you if you don't technically need to build from source, and if you're just getting started with a fresh Cassandra install rather than upgrading an existing one.

I had the same problem when building from source. To get around it, I used a development build from the "Latest Builds (Hudson)" http://cassandra.apache.org/download/ link here.

The next problem you'll encounter is that no keyspaces will be set up on a fresh install. To get around that problem you can use the last release 0.6.3. That solution didn't work for me, because I wanted to use Pycassa which needs 0.7.

So what I had to do was the following steps:

Fire up a JMX console. Personally I'm not located with the server running Cassandra, so I needed to use ssh tunnels, like this:

jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort=1080

Then used this funky looking url to connect:

service:jmx:rmi:///jndi/rmi://my.hostname.com:8080/jmxrmi

Then on the left side

  • expand org.apache.cassandra.service
  • expand Storage Service expand Operations
  • select loadSchemaFromYAML
  • at the top right, click the loadSchemaFromYAML button to invoke it.

You can use the same steps to add new keyspaces during development, once you figure out what you want your schema to look like. But the above steps only work if you have no data. So you would have to remove all your data using rm /var/lib/cassandra/* after taking down the server. (Of course, there are other steps you can take that are more complicated to migrate data without destroying it.)

I realize you didn't ask about creating keyspaces, but on a trunk version of cassandra, if your'e just getting started, that's the very next problem you'll have. I just spent a day solving it, and am hoping it helps.

Unoti
A: 

The first thing you should do is setup CASSANDRA_HOME path to the Cassandra root directory. Try running cassandra cassandra -f and everything will run smooth. (Cassandra actually checks CASSANDRA_HOME environment variable to find the lib folder to run the deamon).

The Elite Gentleman