Peter The Angular Dude
Peter The Angular Dude

Reputation: 1188

Cassandra 2.2.1 will not start using cassandra -f

I've downloaded cassandra from apache.cassandra.

I've made sure my env path vars are correctly set.

I type: cassandra -f in a windows command prompt and this is what I get:

E:\apache-cassandra-2.2.1\bin>cassandra -f
Detected powershell execution permissions.  Running with enhanced startup scripts.
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*

    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 E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:249 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 E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:250 char:5
+     $p.WaitForExit()
+     ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : InvalidOperationException

You cannot call a method on a null-valued expression.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:251 char:5
+     $stderr = $p.StandardError.ReadToEnd()
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:255 char:9
+     if ($stderr.Contains("Error"))
+         ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:268 char:5
+     $sa = $stderr.Split("""")
+     ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Cannot index into a null array.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:269 char:5
+     $env:JVM_VERSION = $sa[1]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

You cannot call a method on a null-valued expression.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:271 char:9
+     if ($stderr.Contains("OpenJDK"))
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Cannot index into a null array.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:284 char:5
+     $pa = $sa[1].Split("_")
+     ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:285 char:5
+     $env:JVM_PATCH_VERSION=$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 E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:413 char:9
+     if (($env:JVM_VERSION.CompareTo("1.7") -eq 1) -and ($env:JVM_ARCH ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:417 char:10
+     if ( (($env:JVM_VERSION.CompareTo("1.7") -ge 0) -and ($env:JVM_PA ...
+          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "Start" with "0" argument(s): "The system cannot find the file specified"
At E:\apache-cassandra-2.2.1\bin\cassandra.ps1:249 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 E:\apache-cassandra-2.2.1\bin\cassandra.ps1:251 char:9
+         $p.WaitForExit()
+         ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : InvalidOperationException


E:\apache-cassandra-2.2.1\bin>

this is driving me nuts. I don't understand why this is so difficult.

I'm running on windows 10 pro and have plenty of space. This is on a LAPTOP and this should work, but of course, it is not.

My cassandra.yaml file is fine.

I'm running localhost as my "seed". Should I make it 127.0.0.1, localhost or just the IP of my local machine?

Do I need to adjust my "etc/hosts" file?

Anyone to help would be appreciated.

Upvotes: 3

Views: 8723

Answers (5)

user1842676
user1842676

Reputation: 66

  1. In the: C:\Program Files\apache-cassandra-3.11.3\conf" folder open the file - "cassandra-env.
  2. Search for: JAVA_HOME
  3. It will show you the path that would be created by the code for java exe file.
  4. Double check and make sure that the path is correct.

You can do it by directly updating the file or by updating the Environment variable as explained in other answers.

Upvotes: 5

Himanshi Ambwani
Himanshi Ambwani

Reputation: 31

This might be due to JAVA_HOME env variable that Cassandra points to. The JAVA_HOME environment variable in .ps1 script file points to JAVA_HOME\bin\java.exe, so in your system the environment variable should be excluding "bin", ie, C:\Program Files\Java\jdk1.8.0_172 to avoid the conflict as after JAVA_HOME it appends bin\java.exe in the file automatically.

p.s This is how it worked for me.

Upvotes: 3

Varaj Vignesh
Varaj Vignesh

Reputation: 341

You can see a line like this $env:JAVA_BIN = "$env:JAVA_HOME\bin\java.exe in cassandra-env.ps1 inside cassandra\conf folder. This error occurs when JAVA_HOME path is wrong . go to system -> environment variables change to JAVA_HOME to correct path which is jdk folder.

Upvotes: 1

LazyZebra
LazyZebra

Reputation: 1113

had the same issue. turns out I wasn't running CMD as Admin... :self-face-slap:

Upvotes: 2

Ravi
Ravi

Reputation: 21

I just faced and resolved a similar error when setting up Cassandra 2.1.11. In my case the script was expecting a JAVA_BIN environment variable. Check the .ps1 script and create the missing environment variable JAVA_BIN pointing ...\bin\java.exe.

Upvotes: 2

Related Questions