Search code examples
javacassandrajava-11centos6cassandra-2.1

Running Cassandra 2.1.17 on Java 11


I am trying to get Cassandra v2.1.17 running using Java 11 (Oracle), but cannot get it to startup. I have updated all the JVM args in cassandra-env.sh to the Java 11 equivalents, but I now get the following error on startup:

ERROR 14:48:10 Exception encountered during startup
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorEnter(Ljava/lang/Object;)V
   at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-16.0.jar:na]
   ...
   ...
   ...
Caused by: java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorEnter(Ljava/lang/Object;)V

I have done a good bit of looking about and it seems that this class was removed in Java 9, or at least deprecated, but was still accessible using --add-modules=jdk.unsupported. Adding this to my JVM args didn't help.

Is it possible to run Cassandra 2.1.17 on Oracle Java 11? I can see that the class is still in OpenJDK 11 (https://hg.openjdk.java.net/jdk/jdk11/file/6889f13694c6/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java) but I am stuck using Centos6 and cannot find an install for it.


Solution

  • @MeanwhileInHell, JDK 11 support for Apache Cassandra(R) was explored in the recent Cassandra 4.0 version only and I don't think it's available in very older and unsupported versions like 2.x. Please see https://cassandra.apache.org/doc/latest/cassandra/new/java11.html documentation for additional details.

    https://issues.apache.org/jira/browse/CASSANDRA-9608 has details.