-->

Cassandra does not start on Java 10

2020-02-14 06:44发布

问题:

I have a brand new Windows 10 Home installation, with a brand-new installation of JDK 10.0.1 (which is what Oracle recommended when I went to the JDK download site.) I just now downloaded Cassandra 3.11.2, un-tar'd it, and put the bin directory on my classpath.

When I attempt to start Cassandra using the cassandra -f command, I get this error:

PS C:\javatools> cassandra -f
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
WARNING! Automatic page file configuration detected.
 It is recommended that you disable swap when running Cassandra
 for performance and stability reasons.
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
Failed 64-bit check. Re-running to get version from 32-bit
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
Cassandra 3.0 and later require Java 8u40 or later.

Java 10 is clearly "Java 8 rel 40 or later". I verified that I was, in fact, running the version of Java I thought I was:

PS C:\javatools> java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

How can I get Cassandra to recognize that I do, in fact, have "Java 8u40 or later"?

回答1:

Cassandra does not support any Java release newer than Java 8.

References are as follows:

  • declined bug report against Java 9: CASSANDRA-9608
  • declined bug report against Java 10: CASSANDRA-14446

Furthermore, even though the documentation does indicate it's a "work in progress", it does indicate the following on the Getting Started page:

Prerequisites

The latest version of Java 8, either the Oracle Java Standard Edition 8 or OpenJDK 8. To verify that you have the correct version of java installed, type java -version.

While it doesn't explicitly say "Java 9 and newer are not supported", this is apparently supposed to be inferred from this indicator.

Finally, the misleading error message appears to be a wontfix item.



回答2:

I've managed to run cassandra 3.11.3 on java-11-openjdk-amd64 on localhost (ubuntu 18.04). (Strangely, java -version shows openjdk version "10.0.1" 2018-04-17)

I tweaked a lot in jvm.options, because many gc options are not supported anymore, and ThreadPriorityPolicy could not be set to 42. (last thing is most annoying: it was really good compaction threads were low priority).

Also, to run nodetool I have to specify jvm 1.8 by JAVA_HOME.