13

I'm trying to run cassandra 3.0 in datastax. But i'm getting an error saying Cassandra 3.0 and later require Java 8u40 or later.

I have installed java and moved the jdk1.8.0_65 to /usr/local/java and set JAVA_HOME to /usr/local/java/jdk1.8.0_65.

But I'm still facing the following error:

Cassandra 3.0 and later require Java 8u40 or later.

A-Sharabiani
  • 17,750
  • 17
  • 113
  • 128
Nandakishore
  • 981
  • 1
  • 9
  • 22

10 Answers10

5

I installed Cassandra 3.2 DataStax Distribution rpm on CentOS 7, and experienced the same problem. Cassandra startup script /etc/rc.d/init.d/cassandra finds java binary in the predefined path list only.

JVM_SEARCH_DIRS="/usr/lib/jvm/jre /usr/lib/jvm/jre-1.7.* /usr/lib/jvm/java-1.7.*/jre"

If your java binary is /usr/jdk64/jdk1.8.0_60/jre/bin/java, append /usr/jdk64/jdk1.8.0_60/jre to JVM_SEARCH_DIRS, or make /usr/lib/jvm/jre symlink for /usr/jdk64/jdk1.8.0_60/jre.

maczniak
  • 1,082
  • 1
  • 8
  • 13
3

Check your java version. if your Java version is "1.8.0_40" later. goto this file apache-cassandra-3.7\conf\cassandra-env.ps1 and search this word JVM_VERSION.CompareTo("1.8.0_40") then change to your version. For example if you use java 1.8.0_102 then change to JVM_VERSION.CompareTo("1.8.0_102").

Now, check. It will work.

Prasad
  • 31
  • 1
2

I typically solve this by adding my specific JAVA_HOME into the $DSE_DIR/resources/cassandra/conf/cassandra.in.sh and $DSE_DIR/bin/dse.in.sh scripts provided with DataStax.
Add: JAVA_HOME=/usr/local/java/jdk1.8.0_65 in each. (Or a symlink, if you want to be able to swap the JVM without re-editing these files.)

Richard Erickson
  • 2,568
  • 8
  • 26
  • 39
Sean Durity
  • 81
  • 1
  • 5
2

The following works for me on a RHEL system:

yum install java-1.8.0-openjdk
ln -nfs /usr/lib/jvm/jre-1.8.0-openjdk.x86_64 /etc/alternatives/jre
ln -nfs /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java /etc/alternatives/java
Varun
  • 4,054
  • 6
  • 31
  • 54
2

I also have same problem. My solution is editing file apache-cassandra-3.7/bin/cassandra. Below line that contain "#!/bin/sh" (2nd line) you can put line like below

JAVA_HOME="/path/of/your/jdk"

example :

JAVA_HOME="/opt/jdk1.8.0_101"

Hope this solution can help you and other people

ekad
  • 14,436
  • 26
  • 44
  • 46
Kentang
  • 110
  • 1
  • 1
  • 8
1
  1. Check first version of java using this command java -version
  2. Check path of java using this command echo $JAVA_HOME
Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
mahendra singh
  • 384
  • 1
  • 13
  • 1
    I rand `update-java-alternatives -s java-8-oracle` first, but that did not fix the softlink that `$JAVA_HOME` was pointing to (i.e. that was still on the OpenJDK)... fixing the softlink fixed the problem. – Alexis Wilke Apr 16 '16 at 05:08
0

Use following commands.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
Neeraj Sharma
  • 1,322
  • 10
  • 9
0

The nodetool might still be accessing the earlier java version, I too faced the same issue.

short do this

sudo vim /etc/environment add this line JAVA_HOME="/usr/lib/jvm/java-8-oracle/jre/bin/java"

source /etc/environment

echo $JAVA_HOME

nodetool status

long do this

Please follow the steps here to install and change the version of java installed in your system . Its explained very well.

mehnaazm
  • 287
  • 1
  • 4
  • 14
0

Try to use alternatives command:

$ nodetool
Cassandra 3.0 and later require Java 8u40 or later.
$ java -version
java version "1.7.0_151"

$ sudo yum install java-1.8.0-openjdk
... 
$ sudo alternatives --config java

There are 2 programs which provide 'java'.

Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
2           /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java

Enter to keep the current selection[+], or type selection number: 2

$ java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
$ nodetool
usage: nodetool [(-p <port> | --port <port>)]
    [(-pwf <passwordFilePath> | --password-file <passwordFilePath>)]
    [(-h <host> | --host <host>)] [(-u <username> | --username <username>)]
    [(-pw <password> | --password <password>)] <command> [<args>]
Konstantin Vustin
  • 6,521
  • 2
  • 16
  • 32
0

it seems, as if the cassandra service would pick up the Java version from alternatives, only.

sudo alternatives --config java

... don't select Java 9 there.

sudo service cassandra start

/etc/cassandra/default.conf/jvm.options has further JVM parameters.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216