Akhil Suseelan
Akhil Suseelan

Reputation: 217

Cassandra is not starting with cassandra -f

I cannot start cassandra with 'cassandra -f' though my environment variables are correct. I'm using Windows 10 machine.

I'm getting the following error!

PS C:\WINDOWS\system32> cassandra -f                                                                                                                                                                            

*---------------------------------------------------------------------* *---------------------------------------------------------------------* WARNING! Automatic page file configuration detected. It is recommended that you disable swap when running Cassandra for performance and stability reasons. *---------------------------------------------------------------------* *---------------------------------------------------------------------* Exception calling "Start" with "0" argument(s): "The system cannot find the file specified" At C:\cassandra\conf\cassandra-env.ps1:212 char:5 + $p.Start() | Out-Null + ~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : Win32Exception Exception calling "WaitForExit" with "0" argument(s): "No process is associated with this object." At C:\cassandra\conf\cassandra-env.ps1:213 char:5 + $p.WaitForExit() + ~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : InvalidOperationException You cannot call a method on a null-valued expression. At C:\cassandra\conf\cassandra-env.ps1:214 char:5 + $stderr = $p.StandardError.ReadToEnd() + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\cassandra\conf\cassandra-env.ps1:218 char:9 + if ($stderr.Contains("Error")) + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\cassandra\conf\cassandra-env.ps1:231 char:5 + $sa = $stderr.Split("""") + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Cannot index into a null array. At C:\cassandra\conf\cassandra-env.ps1:232 char:5 + $env:JVM_VERSION = $sa[1] + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : NullArray You cannot call a method on a null-valued expression. At C:\cassandra\conf\cassandra-env.ps1:234 char:9 + if ($stderr.Contains("OpenJDK")) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Cannot index into a null array. At C:\cassandra\conf\cassandra-env.ps1:247 char:5 + $pa = $sa[1].Split("_") + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : NullArray Cannot index into a null array. At C:\cassandra\conf\cassandra-env.ps1:248 char:5 + $subVersion = $pa[1] + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : NullArray *---------------------------------------------------------------------* *---------------------------------------------------------------------* WARNING! Detected a power profile other than High Performance. Performance of this node will suffer. Modify conf\cassandra.env.ps1 to suppress this warning. *---------------------------------------------------------------------* *---------------------------------------------------------------------* You cannot call a method on a null-valued expression. At C:\cassandra\conf\cassandra-env.ps1:406 char:9 + if ($env:JVM_VERSION.CompareTo("1.8.0") -eq -1 -or [convert]::ToI ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Exception calling "Start" with "0" argument(s): "The system cannot find the file specified" At C:\cassandra\bin\cassandra.ps1:251 char:9 + $p.Start() | Out-Null + ~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : Win32Exception Exception calling "WaitForExit" with "0" argument(s): "No process is associated with this object." At C:\cassandra\bin\cassandra.ps1:253 char:9 + $p.WaitForExit() + ~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : InvalidOperationException

Upvotes: 3

Views: 2128

Answers (2)

KGhatak
KGhatak

Reputation: 7305

I ran into the same issue with Cassandra 3.11.7 on Windows 10, and resolved it by setting JAVA_HOME properly. I found that JAVA_HOME should point to the parent of 'bin', e.g. to "C:\Program Files\Java\jre1.8.0_261" and not to "C:\Program Files\Java\jre1.8.0_261\bin". This has resolved the error "The system cannot find the path specified."

Credit: https://github.com/elastic/elasticsearch/issues/2274

Upvotes: 1

Aaron
Aaron

Reputation: 57808

So this is the line that it looks like it's failing on:

 if ($env:JVM_VERSION.CompareTo("1.8.0") -eq -1

When I'm on a CentOS (Linux) box, and I run java -version, I see the following output:

$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

As you can see, that version on that first line comes back in certain format "1.8.0_191."

So a couple of points about that:

  1. I have no idea what the output of java -version shows for Java 12, but I do know that the format is different for some JDK vendors. For example, the AdoptOpenJDK deployment causes issues with Cassandra 4.0 (as per this JIRA: https://issues.apache.org/jira/browse/CASSANDRA-14926).

  2. Cassandra version 3 (and prior) only work with Java 8. Cassandra 4 (not yet released) will support up to Java 11. AFAIK, Java 12 isn't on the roadmap, yet.

For sure, I would install a lower version of Java. If you're working with Cassandra 3, you should install the latest patch of Java 8.

If you continue to have problems, I would remove the Java version checks from the cassandra-env.ps1 file. Although, you do so at your own peril.

Upvotes: 2

Related Questions