Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot start service after Elasticsearch upgrade from 1.4.1 to 1.4.4

I have installed Elasticsearch successfully on Windows 7 version x64, using ELS 1.4.1. After upgrading to Kibana 4 RTM, it required ELS 1.4.4.

To carry out the upgrade, I performed the following steps:

  1. Downloaded ELS 1.4.4
  2. Stopped and removed the ELS 1.4.1 service
  3. Renamed the current install directory to elasticsearch_bak
  4. Extracted the 1.4.4 zip to the elasticsearch directory
  5. Compared the /config/elasticsearch.yml and config/logging.yml and applied the changes (which contains the following additional settings at the bottom)
# Helps Chrome work properly
http.cors.allow-origin: "/.*/"
http.cors.enabled: true

Upon starting the service, it stops within a few seconds. The logs are as follows:

Java Version

(Note this is for development purposes)

java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) Client VM (build 25.31-b07, mixed mode, sharing)

Event Log

The Elasticsearch 1.4.4 (elasticsearch) service terminated with service-specific error Incorrect function..

elasticsearch-stderr-2015.05.20.log

2015-02-20 08:49:13 Commons Daemon procrun stderr initialized
Exception in thread "main" ror: Could not initialize class org.elasticsearch.Version
    at org.elasticsearch.bootstrap.Bootstrap.buildErrorMessage(Bootstrap.java:254)
    at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:238)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
The data area passed to a system call is too small.

Failed to start service

elasticsearch-stdout-2015.05.20.log

2015-02-20 08:46:03 Commons Daemon procrun stdout initialized

elasticsearch.2015-02-20.log

[2015-02-20 08:49:14] [info]  ( prunsrv.c:1284) [ 8560] Service started in 1198 ms.
[2015-02-20 08:49:14] [debug] ( prunsrv.c:844 ) [ 8560] reportServiceStatusE: 4, 0, 0, 0
[2015-02-20 08:49:14] [debug] ( prunsrv.c:1528) [ 8560] Waiting for worker to finish...
[2015-02-20 08:49:14] [debug] ( prunsrv.c:1533) [ 8560] Worker finished.
[2015-02-20 08:49:14] [debug] ( prunsrv.c:1559) [ 8560] Waiting for all threads to exit
[2015-02-20 08:49:14] [debug] ( prunsrv.c:844 ) [ 8560] reportServiceStatusE: 3, 0, 0, 0
[2015-02-20 08:49:14] [debug] ( prunsrv.c:1563) [ 8560] JVM destroyed.
[2015-02-20 08:49:14] [debug] ( prunsrv.c:844 ) [ 8560] reportServiceStatusE: 1, 1066, 0, 1
[2015-02-20 08:49:14] [info]  ( prunsrv.c:1598) [10064] Run service finished.
[2015-02-20 08:49:14] [info]  ( prunsrv.c:1764) [10064] Commons Daemon procrun finished
[2015-02-20 08:49:14] [info]  ( prunsrv.c:1764) [10064] Commons Daemon procrun finished
[2015-02-20 08:49:16] [error] ( prunsrv.c:746 ) [10116] Failed to start 'elasticsearch' service
[2015-02-20 08:49:16] [error] ( prunsrv.c:746 ) [10116] The data area passed to a system call is too small.
[2015-02-20 08:49:16] [info]  ( prunsrv.c:754 ) [10116] Start service finished.
[2015-02-20 08:49:16] [error] ( prunsrv.c:1755) [10116] Commons Daemon procrun failed with exit value: 5 (Failed to start service)
[2015-02-20 08:49:16] [error] ( prunsrv.c:1755) [10116] The data area passed to a system call is too small.

If I run elasticsearch from the command prompt, I get this error:

c:\elk\elasticsearch\bin>elasticsearch
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.Version
        at org.elasticsearch.bootstrap.Bootstrap.buildErrorMessage(Bootstrap.java:254)
        at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:238)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
like image 832
Dominic Zukiewicz Avatar asked Feb 20 '15 08:02

Dominic Zukiewicz


3 Answers

I had the exact same issue and here is how I've fixed it.

Here is my setup

I am using Windows Server 2008 R2 Enterprise - 64-bit version. Everything worked fine with Java (JRE) version 1.8.0_25. Elastic search was installed as Windows Service.

Exactly before the issue I updated Java to version 1.8.0_31 and restarted the machine.

Here is the history of steps I took

Firstly after restarting the machine I've noticed that ElasticSearch service was stopped. After trying to start it it stopped again.

Here is what I get in my Events Log for the issue:

The Elasticsearch 1.4.1 (elasticsearch-service-x64) service terminated with service-specific error Incorrect function..

Here is what I had in my elasticsearch-service-x64.2015-02-27.log:

[2015-02-27 14:38:29] [info]  [ 4948] Commons Daemon procrun (1.0.15.0 64-bit) started
[2015-02-27 14:38:29] [info]  [ 4948] Running 'elasticsearch-service-x64' Service...
[2015-02-27 14:38:29] [info]  [ 3048] Starting service...
[2015-02-27 14:38:29] [error] [ 3048] Failed creating java C:\Program Files\Java\jre1.8.0_25\bin\server\jvm.dll
[2015-02-27 14:38:29] [error] [ 3048] The system cannot find the path specified.
[2015-02-27 14:38:29] [error] [ 3048] ServiceStart returned 1
[2015-02-27 14:38:29] [error] [ 3048] The system cannot find the path specified.
[2015-02-27 14:38:29] [info]  [ 4948] Run service finished.
[2015-02-27 14:38:29] [info]  [ 4948] Commons Daemon procrun finished

Then I've changed the value of JAVA_HOME system variable to C:\Program Files\Java\jre1.8.0_31

enter image description here

The issue then was:

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.Version
        at org.elasticsearch.bootstrap.Bootstrap.buildErrorMessage(Bootstrap.java:254)
        at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:238)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)

What fixed the problem

  1. I've completely deleted folders bin, config, lib and plugins from the ElasticSearch folder.

    Be sure to not to delete data directory because there are located your indexes!

  2. Unzipped the same folders (bin, config and lib) from elasticsearch-1.4.4.zip.
  3. Ran SC DELETE elasticsearch-service-x64 as administrator in Command Prompt (to delete the installed service)
  4. Ran F:\Services\elasticsearch\bin>service.bat install

    Installing service      :  "elasticsearch-service-x64"
    Using JAVA_HOME (64-bit):  "C:\Program Files\Java\jre1.8.0_31"
    The service 'elasticsearch-service-x64' has been installed.
    
  5. Started the service

And then everything started to work correctly.

enter image description here

like image 198
Nikolay Kostov Avatar answered Oct 20 '22 13:10

Nikolay Kostov


I have the same problem. Its appear after update to new version of Java. Although I change value of "JAVA_HOME" variable to new java directory, the problem stay.

Than I go to command prompt, navigate to ES directory and run the following command:

{ElasticSearch directory}\bin>service manager

This command will open Elasticsearch properties window.(http://i.stack.imgur.com/QQEPG.png)

Than go to Java tab and change path of Java Virtual Machine to new version of Java. After that just run ES service

{ElasticSearch directory}\bin>service start
like image 18
Madjarov Avatar answered Oct 20 '22 14:10

Madjarov


The issue is caused by service.bat distributed with Elastic which rely on Apache Common Procrun and sets the JVM using the environment variable %JAVA_HOME% which is not resolved correctly.

So I fixed the issue by setting "Default JVM" on the GUI that appears with service.bat manager.

Another way to fix the issue via command line is

elasticsearch-service-x64.exe //US//YOUR_SERVICE_NAME --Jvm auto

i.e.

elasticsearch-service-x64.exe //US//elasticsearch-service-x64 --Jvm auto
like image 13
emmekappa Avatar answered Oct 20 '22 13:10

emmekappa