2

I have problems starting Cassandra. The follow is my terminal output when I try to issue a start command:

root@gestion:~# cassandra -f
Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: java.lang.RuntimeException: Couldn't figure out log4j configuration. at org.apache.cassandra.service.AbstractCassandraDaemon.(AbstractCassandraDaemon.java:75) Could not find the main class: org.apache.cassandra.thrift.CassandraDaemon.
Program will exit.

I exported the JAVA_HOME path. I am on an 10.04 Lucid machine. Can anyone please help me?

Crowie
  • 3,220
  • 7
  • 28
  • 48
ssich
  • 79
  • 1
  • 2
  • 5
  • 1
    You should explain exactly how you have differed from the steps in http://wiki.apache.org/cassandra/GettingStarted, because un-tarring it and running "bin/cassandra -f" works every time. – jbellis Jul 06 '11 at 02:52

3 Answers3

4

Actually the issue is that cassandra could not start up as it is not finding the file named "log4j-server.properties" in its configuration directory, to resolve the issue you have there, no need to reinstall it again but instead simply do the following to resolve the issue:

1) Download the tarball file from here.

2) Extract it:

$ tar -xzvf apache-cassandra-1.2.5.tar.bin.gz 

3) Check where is the configuration path of cassandra. you could get the config path from file named "/usr/share/cassandra/cassandra.in.sh", check out the key named "CASSANDRA_CONF".

$ gedit /usr/share/cassandra/cassandra.in.sh

4) copy the missing files manually from the extracted package (step 2) from a directory named "conf"

$ sudo cp extracted_cassandra/conf/cassandra.yaml /etc/cassandra

$ sudo cp extracted_cassandra/conf/log4j-server.properties /etc/cassandra

Hints:

For more info. how to install cassandra debian package, check this For more info. how to install cassandra from their repository, check this

If you want to re-install it, simply you could do the following:

$ sudo apt-get remove cassandra 

$ sudo apt-get install cassandra
Muhammad Soliman
  • 21,644
  • 6
  • 109
  • 75
2

I think the error is in the $CASSANDRA_HOME/conf/log4j-server.properties file. Maybe you have defined an appender which does not exist (log4j.appender.R)

strauberry
  • 4,189
  • 5
  • 34
  • 50
  • Here you can have a look at the java code: http://grepcode.com/file/repo1.maven.org/maven2/org.apache.cassandra/cassandra-all/0.7.4/org/apache/cassandra/service/AbstractCassandraDaemon.java. Maybe the file is not accessible due to permission issues?! – strauberry Jul 04 '11 at 18:23
2

See https://issues.apache.org/jira/browse/CASSANDRA-2383 for some discussion of the log4j initialization.

"Couldn't figure out log4j configuration" means that Cassandra couldn't convert your -Dlog4j.configuration property to a valid log4j config filename. It doesn't mean there's an error in the log4j config file itself.

DNA
  • 42,007
  • 12
  • 107
  • 146