hyvbug
hyvbug

Reputation: 147

Cassandra could not create Java Virtual Machine

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?

Upvotes: 8

Views: 6617

Answers (3)

Manas Kumar Maharana
Manas Kumar Maharana

Reputation: 935

IF you are using above Java8 then change to variable to java8 else create one bat file and set java8 like below then run Cassandra.

@ECHO OFF  
SET "JAVA_HOME= Java8 home path"  
SET "path=JAVA_HOME\bin"  
echo JAVA_HOME: %JAVA_HOME%  
echo path: %path%

Now navigate to Cassandra folder then run Cassandra bat file 
Enjoy using Cassandra **:)** 

Upvotes: 0

Chinmay Biswal
Chinmay Biswal

Reputation: 393

Apache Cassandra 3.11.10 runs with Java 8 only. In PowerShell set the execution policy to Unrestricted

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

Set-ExecutionPolicy Unrestricted

And if you get error related to Sigar then comment that line in cassandra-env.ps1 File under Conf folder.

Comment the below line

# $env:JVM_OPTS = "$env:JVM_OPTS -Djava.library.path=""$env:CASSANDRA_HOME\lib\sigar-bin"""

Upvotes: 0

Aaron
Aaron

Reputation: 57748

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.

Upvotes: 1

Related Questions