Not able to start elastic search service

mp3duck picture mp3duck · Mar 30, 2016 · Viewed 21.5k times · Source

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.

Answer

Brian Webster picture Brian Webster · Jan 22, 2017

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.