14

I am trying to start the Elastic Search service on a Windows 2008 R2 server, but it's failing to start. It had previously been running for several months without issue.

In services, I get the message:

"Windows could not start the Elasticsearch 1.7.2 (ELASTIC_POC) on Local Computer. For more information, review the System Event Log. If this is a non_Microsoft service, contact the service vendor, and refer to service specific error code 1."

Event log was very unhelpful, showing the following error:

"The Elasticsearch 1.7.2 (ELASTIC_POC) service entered the stopped state."

"The Elasticsearch 1.7.2 (ELASTIC_POC) service terminated with service-specific error Incorrect function.."

I do get more information in Elastic Search own log files however:

[2016-03-30 10:47:22] [info]  [ 3988] Running 'ELASTIC_POC' Service...
[2016-03-30 10:47:22] [info]  [ 3760] Starting service...
[2016-03-30 10:47:22] [error] [ 3760] Failed creating java C:\Progra~2\Java\jre1.8.0_60\bin\client\jvm.dll
[2016-03-30 10:47:22] [error] [ 3760] The system cannot find the path specified.
[2016-03-30 10:47:22] [error] [ 3760] ServiceStart returned 1
[2016-03-30 10:47:22] [error] [ 3760] The system cannot find the path specified.
[2016-03-30 10:47:22] [info]  [ 3988] Run service finished.
[2016-03-30 10:47:22] [info]  [ 3988] Commons Daemon procrun finished

Checking C:\Program Files (x86)\Java\jre1.8.0_60, it only contains a folder named "lib" (which is empty). There is a "jre1.8.0_73" folder that has several files, "including \bin\client\jvm.dll"

How can I either make Elastic Search use the later Java release, or bring back the contents for the jre1.8.0_60 folder? I can't seem to find (a safe to download) installer for this..

Any help greatly appreciated.

mp3duck
  • 2,633
  • 7
  • 26
  • 40
  • 1
    What is the result of `echo %JAVA_HOME%`? – Rob Mar 30 '16 at 10:09
  • C:\Progra~2\Java\jre1.8.0_73 although I did update this (in Environment settings) before seeing your message.. I am still getting the same error (I rebooted server to be sure) – mp3duck Mar 30 '16 at 10:18
  • you should accept Brian Webster's answer as the correct one. – Tamb Oct 15 '18 at 21:57

5 Answers5

33

There is a very high probability that your Java Runtime Environment was auto-updated.

This will break Elastic Search because you have an environment variable called JAVA_HOME that is now pointed at the wrong location.

First, go into program files / java and find the new folder of JRE. It is probably a later version number. Example: instead of jre1.8.0_73, perhaps jre1.8.090 or some higher number tacked onto the end.

Update your JAVA_HOME environment variable accordingly.

Then, after taking appropriate backups of your elastic search files, in an admin-enabled command prompt, navigate to your elastic search bin folder.

type the following commands

 service remove
 service install

Then, you will probably want to go into services.msc and switch the service from "manual start" to "automatic" or "automatic delayed"

One might think that reinstalling the service after updating the JAVA_HOME environment variable would be unnecessary, but it was necessary for my installation.

Brian Webster
  • 30,033
  • 48
  • 152
  • 225
4

Resolved, by install service again..

Open

{path-to-elastic-search}\bin\

in command prompt,

and run

service install

It would not allow me to run

service remove, so I now how two elastic search services listed, however, this is a test server, so that's fine.

mp3duck
  • 2,633
  • 7
  • 26
  • 40
4

For me it was caused by a problem in my registry after updating Java. It seemed that older versions of the service installer hardcoded the java path in the registry keys while they should depend on the JAVA_HOME environment variable.

Locate the following key in your registry: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\elasticsearch-service-x64\Parameters\Java\Jvm. If it looks like a hardcoded path to jvm.dll, change the value to %JAVA_HOME%\bin\server\jvm.dll and try starting the service.

Jorrit Schippers
  • 1,538
  • 12
  • 17
3

Just do the following steps step by step and then your elastic search installation will work: advanced system setting >> Environment variables >> System Variables >> path >> New and then insert your latest java jdk path. like this: C:\Program Files\Java\jdk-11.0.3\bin

Eli
  • 31
  • 1
2

For me the solution was creating directory \AppData\Local\Temp\elasticsearch. Apparently something during Windows Update has deleted this folder for some reason.

Phil Dukhov
  • 67,741
  • 15
  • 184
  • 220