Cassandra 3.0 and later require Java 8u40 or later
Asked Answered
P

10

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.

Portly answered 21/12, 2015 at 22:7 Comment(2)
What distribution are you using? I found a solution for this for Ubuntu, which I will write up if that would help.Myosin
I'm using datastax. Learning cassandra from there so using datastax distribution.Portly
P
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.

Passionate answered 2/2, 2016 at 13:45 Comment(0)
C
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.

Calvo answered 9/9, 2016 at 5:56 Comment(0)
D
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.)

Deva answered 3/2, 2016 at 19:26 Comment(0)
C
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
Campanulaceous answered 22/4, 2016 at 10:25 Comment(1)
This solution worked for me on Amazon EC2 AMI, thank you.Dongdonga
F
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

Feints answered 13/9, 2016 at 3:33 Comment(0)
H
1
  1. Check first version of java using this command java -version
  2. Check path of java using this command echo $JAVA_HOME
Homothermal answered 7/3, 2016 at 12:9 Comment(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.Gombosi
S
0

Use following commands.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
Schizont answered 7/3, 2016 at 10:34 Comment(0)
H
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.

Hofstetter answered 5/8, 2016 at 14:25 Comment(0)
G
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>]
Gem answered 7/12, 2017 at 6:21 Comment(0)
F
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.

Ferdinande answered 5/2, 2018 at 9:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.