Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra could not create Java Virtual Machine

Tags:

java

cassandra

I am on a Mac OS and I run cassandra -f and immediately this happens:

[0.002s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:/usr/local/apache-cassandra-3.0.10/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.```

I have no idea why this is happening. I did the proper

export CASSANDRA_HOME=/usr/local/apache-cassandra-3.0.10
export PATH=$PATH:$CASSANDRA_HOME/bin

But still it isnt working properly.

Is it something with my Java version? How can I do a complete clean install of Cassandra/get this to work?

like image 543
hyvbug Avatar asked Jan 29 '19 04:01

hyvbug


1 Answers

In that version of Cassandra, the UseParNewGC setting is defined in the jvm.options file. It is the first setting in the block of CMS GC JVM settings.

#################
#  GC SETTINGS  #
#################

### CMS Settings

-XX:+UseParNewGC
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled

I suspect one of two things are going on.

  1. It's possible that the -XX:+UseParNewGC setting is not appropriately specified. Double check this in your jvm.options file.
  2. The more-likely scenario, is that a previous, erroneous edit made to the jmv.options file above the block I have shown above, is causing the issue. As the -XX:+UseParNewGC line is the first line in this block, the error appears to be here. The section above is where the heap sizing parameters are set, so I would check to see if something was uncommented or perhaps a quote was not properly closed.
  3. Check your Java version with a java -version. Newer versions of Java (like 10 or 11 and higher) do not support the parallel garbage collector. Also, Cassandra 3.x only runs on Java 8, so you really don't have a reason to be on a recent JVM like that.
like image 77
Aaron Avatar answered Sep 21 '22 20:09

Aaron