当我运行命令$ nodetool help
时,我收到以下错误;
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)
如果有人有任何提示,请告诉我。
答案 0 :(得分:1)
我有同样的错误。
我建议你也使用java 7或8(未测试7),而不是java 9或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)
我假设cassandra代码尝试在某处解析java版本而不处理最新的java版本
答案 1 :(得分:1)
我遇到了同样的错误,但是您可以通过明确指定配置来解决此问题:
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
答案 2 :(得分:0)
如果要运行help命令,请转到Cassandra的bin目录,然后运行以下命令 -
./nodetool help
答案 3 :(得分:0)
我可以通过降级默认的Java版本在Ubuntu 18.4上解决它:
sudo update-alternatives --config java
输出应如下所示:
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
现在只需选择Java版本8。您可以尝试使用java -version
进行所有操作。