Kevin Kevin - 7 months ago 66
Java Question

Cassandra 2.0 and later require Java 7u25 or later but i'm using 8u60

I'm trying to run cassandra as a service using a init script but I keep getting the error "Cassandra 2.0 and later require Java 7u25 or later."

In the init script I'm running cassandra under a cassandra user:

#!/bin/bash
# init script for Cassandra.
# chkconfig: 2345 90 10
# description: Cassandra

. /etc/rc.d/init.d/functions

CASS_HOME=/etc/cassandra
CASS_BIN=$CASS_HOME/bin/cassandra
CASS_LOG=/var/log/cassandra/cassandra.out
CASS_USER="cassandra"
CASS_PID=/var/run/cassandra/cassandra.pid
prog=Cassandra

RETVAL=0
start() {
if [ -f $CASS_PID ] && checkpid `cat $CASS_PID`; then
echo "Cassandra is already running."
exit 0
fi
echo -n $"Starting $prog: "
daemon --user $CASS_USER $CASS_BIN -p $CASS_PID >> $CASS_LOG 2>&1
usleep 500000
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
echo_success
else
echo_failure
fi
echo
return $RETVAL
}


The cassandra user is definitely running 8u60:

> sudo runuser -l cassandra -c 'echo $JAVA_HOME'
/usr/java/jdk1.8.0_60
> sudo runuser -l cassandra -c 'java -version'
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)


I modified the cassandra-env.sh script to print out the user and java version in with the error and they confirm that the script is seeing an older version of java but i'm not sure how that's possible when it seems fine for the cassandra user.

Cassandra 2.0 and later require Java 7u25 or later.
Found JVM 1.6.0, patch 38, current user cassandra.


Any help appreciated!

Answer

It's not running actually as the cassandra user, just under its uid. The environment is different and doesn't contain the correct java version. Check the java version as root and it'll point to a Java 6 JRE.

Comments