Cassandra nodetool java.lang.NullPointerException - cassandra

When I run the command $ nodetool help I get the following error;
java.lang.NullPointerException
at org.apache.cassandra.config.DatabaseDescriptor.getDiskFailurePolicy(DatabaseDescriptor.java:1877)
at org.apache.cassandra.utils.JVMStabilityInspector.inspectThrowable(JVMStabilityInspector.java:62)
at org.apache.cassandra.io.util.FileUtils.<clinit>(FileUtils.java:79)
at org.apache.cassandra.utils.FBUtilities.getToolsOutputDirectory(FBUtilities.java:807)
at org.apache.cassandra.tools.NodeTool.printHistory(NodeTool.java:199)
at org.apache.cassandra.tools.NodeTool.main(NodeTool.java:167)
Please let me know if anyone has any tips.

I've got the same error.
I suggest you too use java 7 or 8 (not tested 7), and not java 9 or 10.
$ java -version # java 8
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
$ java --version # java 9
java 9.0.4
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
$ nodetool # java 9
error: null
-- StackTrace --
java.lang.NullPointerException
at org.apache.cassandra.config.DatabaseDescriptor.getDiskFailurePolicy(DatabaseDescriptor.java:1881)
at org.apache.cassandra.utils.JVMStabilityInspector.inspectThrowable(JVMStabilityInspector.java:82)
at org.apache.cassandra.io.util.FileUtils.<clinit>(FileUtils.java:79)
at org.apache.cassandra.utils.FBUtilities.getToolsOutputDirectory(FBUtilities.java:788)
at org.apache.cassandra.tools.NodeTool.printHistory(NodeTool.java:200)
at org.apache.cassandra.tools.NodeTool.main(NodeTool.java:168)
I assume cassandra code try to parse java version somewhere and don't handle lastest java versions

I could solve it on Ubuntu 18.4 by downgrading the default java version version:
sudo update-alternatives --config java
The output should look like:
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
* 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Now just choose java version 8. You can try if everything worked with java -version.

I got the very same error, but you can workaround it with specifiing the config explictely:
JAVA_HOME="/opt/java/my-java"
PATH="$JAVA_HOME/bin:$PATH"
# run the node tool
CASSANDRA_CONF=/path/tocassandra/conf.d \
JAVA_TOOL_OPTIONS= \
JAVA_HOME=/opt/java/my-java \
./bin/nodetool status
HTH

If you want to run help command then move to the bin directory of Cassandra, then run following command -
./nodetool help

Related

Why can't I run CassandraDB on Windows 10 with the latest Java installed?

When I try to start up Cassandra DB under windows 10, It complains about the Java version:
Cassandra 3.0 and later require Java 8u40 or later.
I believe I have the latest Java installed:
java --version
java 13.0.2 2020-01-14
Java(TM) SE Runtime Environment (build 13.0.2+8)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
I've installed Apache Cassandra 3.11.9 (the open source version not the Datastax version).
Why doesn't Cassandra recognize this version of Java? Do I need to install a different version of Java to get this working?
Yes, you need to install Java 8 to run Cassandra 3.11 - it will not work with Java 13 (yes, I understand that error message isn't clear). Support for Java > 8 was added only to Cassandra 4.0, that is currently in beta.
Also, on Windows it would be easier to use Docker to run Cassandra - there are different difficulties with running Cassandra on Windows.

Error installing Cassandra on Mac with Java 13

I am using macOS Mojave My Java version is 13.0
I am a beginner in Cassandra please help me to fix this I read lot of post regarding this error but all are old not working with the current version
webz$ java -version
java version "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
cassendra error :-
Webzs-MacBook-Pro:~ webz$ cassandra
Webzs-MacBook-Pro:~ webz$ [0.001s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:/usr/local/cassandra/bin/../logs/gc.log instead.
Unrecognized VM option 'UseParNewGC'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
In the jvm.options file of Cassandra, check if this is enabled.
-XX:+UseParNewGC
If yes, then you can comment that and replace with this
-XX:+UseG1GC
This is because support for UseParNewGC has been disabled in Java 10.
https://bugs.openjdk.java.net/browse/JDK-8151084
You may run into other issues also because of your java version as released versions of Cassandra support only Java 8. The support for higher versions will be in Cassandra 4.0 but that isn't released yet.
As it states in the Installation prerequisites, Cassandra 3.x (or earlier versions) only work with Java 8.
Cassandra 4.0.2 added full support for Java 11 only recently (CASSANDRA-16894). This means that C* 4.x will work with either Java 8 or Java 11.
Cassandra will not work with Java 13. For what it's worth, we are working on supporting Java 17 LTS in the next major release of Cassandra (CASSANDRA-16895). Cheers!

How do I fix JavaFX runtime components are missing?

I have the following installed on Ubuntu 18.04.1 LTS:
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1, mixed mode)
javafx.runtime.version=8.0.161
javafx.runtime.build=b00
However I try to run the sample java application that uses javafx I get the following error:
$ java -jar Untitled.jar
Error: JavaFX runtime components are missing, and are required to run this application
I have tried to run it in Eclipse, Intelli, and in the terminal with the same error.
I have set the classpath
:~$ echo $CLASSPATH
/usr/share/java/openjfx/jre/lib/ext/jfxrt.jar:.
I have copied all of the javafx files to the current directory.
I have tried everything I can find on the internet.
Does anyone know how to fix this?
On Ubuntu 18.04 with openjdk-11-jre and openjfx installed you could use:
% java --module-path /usr/share/openjfx/lib --add-modules ALL-MODULE-PATH \
-jar Untitled.jar
There is more information on how to run JavaFX programs at the openjfx.io site.

Cassandra does not start on Java 10

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"?
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.
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.

Why can not I run Intellij on Linux Mint for Java version error?

When I try to run intellij, it shows the following message-
Can not start under java 1.7.0_51-b13:Java 1.8 or later is required!
But when I checked the version of the Java in the machine-
java -version
I get-
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)
What could be the reason for not working this?
Newer versions of IntelliJ IDEA explicitly require Java 8 to run.
Some things that can be done:
Uninstall older versions of Java
Ensure that which java points to the correct version of Java
Ensure that Java 8 is selected via update-alternatives --config java
Check the variables IDEA_JDK, JDK_HOME, and JAVA_HOME, and be sure they don't point to Java 7. If all else fails, IDEA defaults to whichever java is on the path, so unsetting those variables may be a viable option.
Can you check if you have a JAVA_HOME env variable set ? If yes, it might use this version instead of the java binary available in your path.

Resources