# Magento2: Elasticsearch failed to start: problem with java

**URL:** <https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321>\
**Category:** Elasticsearch\
**Created:** [June 3, 2022, 10:08am UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321 "2022-06-03T10:08:25Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Konstantina\_Gerou](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/konstantina_gerou/32/106574_2.png) [@Konstantina\_Gerou](https://discuss.elastic.co/u/Konstantina_Gerou)\
**Post date:** [June 3, 2022, 10:08am UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/1 "2022-06-03T10:08:25Z")

</div>

Hello,  
I've installed Magento2.4.4 in ubuntu20.04 VM. When i did the installation everything was fine.  
Now I am facing a failure . I tried almost everything to fix it, but nothing. Here is the output:

 ![image_2022-06-03_130325663](https://us1.discourse-cdn.com/elastic/original/3X/0/4/0433106cd53622f620c2a232adc867fb5af19820.png)

Also in the Elasticsearch.yml file I changed only the network host: 127.0.0.1.  
In the jvm.options file:  
 ![image_2022-06-03_130608414](https://us1.discourse-cdn.com/elastic/original/3X/e/2/e210c7b0787890b1da09e9e52e066c6ee1bc6420.png)  
 ![image_2022-06-03_130625918](https://us1.discourse-cdn.com/elastic/original/3X/b/0/b09ab911db46e7a46791e734e8772ed7a0bd6fc1.png)

 ![image_2022-06-03_130649549](https://us1.discourse-cdn.com/elastic/original/3X/5/3/538eae0a06725a0cb09b98af9e4bbcad1a744ce5.png)  
 ![image_2022-06-03_130718260](https://us1.discourse-cdn.com/elastic/original/3X/b/1/b13218ba7409c3a7b56b4d3aeeec0b01a27d1e97.png)

I have java version:11 end elaasticsearch version is: 7  
I do not know what else to do. Any suggestion?

---

<div class="post-metadata">

**Author:** ![DineshNaik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dineshnaik/32/89308_2.png) [@DineshNaik](https://discuss.elastic.co/u/DineshNaik)\
**Post date:** [June 3, 2022, 12:10pm UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/2 "2022-06-03T12:10:10Z")

</div>

@Konstantina_Gerou Welcome to the community.

Can you share the full stack trace from es log file . It's not clear and incomplete trace to figure out the actual cause .

---

<div class="post-metadata">

**Author:** ![Konstantina\_Gerou](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/konstantina_gerou/32/106574_2.png) [@Konstantina\_Gerou](https://discuss.elastic.co/u/Konstantina_Gerou)\
**Post date:** [June 3, 2022, 12:13pm UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/3 "2022-06-03T12:13:56Z")

</div>

Do you mean this?

 ![image_2022-06-03_151341307](https://us1.discourse-cdn.com/elastic/original/3X/e/5/e573c4e09b8290c3c50306d74c2dc3c9806f6daf.png)

---

<div class="post-metadata">

**Author:** ![DineshNaik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dineshnaik/32/89308_2.png) [@DineshNaik](https://discuss.elastic.co/u/DineshNaik)\
**Post date:** [June 3, 2022, 1:27pm UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/4 "2022-06-03T13:27:55Z")

</div>

Yes , if possible copy paste the full content of the file , rather than attaching screen shot.

---

<div class="post-metadata">

**Author:** ![Konstantina\_Gerou](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/konstantina_gerou/32/106574_2.png) [@Konstantina\_Gerou](https://discuss.elastic.co/u/Konstantina_Gerou)\
**Post date:** [June 3, 2022, 1:33pm UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/5 "2022-06-03T13:33:46Z")

</div>

● Elasticsearch.service - Elasticsearch  
Loaded: loaded (/lib/systemd/system/Elasticsearch.service; enabled; vendor preset: enabled)  
Active: failed (Result: exit-code) since Fri 2022-06-03 12:07:11 UTC; 1h 22min ago  
Docs: [https://www.elastic.co](https://www.elastic.co)  
Main PID: 37068 (code=exited, status=1/FAILURE)

Jun 03 12:07:11 backup-71745322-ubuntu-4gb-hel1-1 systemd-entrypoint[37221]: at java.base/java.nio.file.Files.newByteChannel(Files.java:380)  
Jun 03 12:07:11 backup-71745322-ubuntu-4gb-hel1-1 systemd-entrypoint[37221]: at java.base/java.nio.file.Files.newByteChannel(Files.java:432)  
Jun 03 12:07:11 backup-71745322-ubuntu-4gb-hel1-1 systemd-entrypoint[37221]: at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422)  
Jun 03 12:07:11 backup-71745322-ubuntu-4gb-hel1-1 systemd-entrypoint[37221]: at java.base/java.nio.file.Files.newInputStream(Files.java:160)  
Jun 03 12:07:11 backup-71745322-ubuntu-4gb-hel1-1 systemd-entrypoint[37221]: at org.Elasticsearch.tools.launchers.JvmOptionsParser.readJvmOptionsFiles(JvmOptionsParser.java:168)  
Jun 03 12:07:11 backup-71745322-ubuntu-4gb-hel1-1 systemd-entrypoint[37221]: at org.Elasticsearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:124)  
Jun 03 12:07:11 backup-71745322-ubuntu-4gb-hel1-1 systemd-entrypoint[37221]: at org.Elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:86)  
Jun 03 12:07:11 backup-71745322-ubuntu-4gb-hel1-1 systemd[1]: Elasticsearch.service: Main process exited, code=exited, status=1/FAILURE  
Jun 03 12:07:11 backup-71745322-ubuntu-4gb-hel1-1 systemd[1]: Elasticsearch.service: Failed with result 'exit-code'.  
Jun 03 12:07:11 backup-71745322-ubuntu-4gb-hel1-1 systemd[1]: Failed to start Elasticsearch.  
~  
Here it is

---

<div class="post-metadata">

**Author:** ![Konstantina\_Gerou](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/konstantina_gerou/32/106574_2.png) [@Konstantina\_Gerou](https://discuss.elastic.co/u/Konstantina_Gerou)\
**Post date:** [June 3, 2022, 1:34pm UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/6 "2022-06-03T13:34:36Z")

</div>

And here is a more clear screenshot

 ![Screenshot from 2022-06-03 16-32-41](https://us1.discourse-cdn.com/elastic/original/3X/d/b/db66f6eb40d540d8340ddfd8f0dc70ed9b5538bc.png)

---

<div class="post-metadata">

**Author:** ![DineshNaik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dineshnaik/32/89308_2.png) [@DineshNaik](https://discuss.elastic.co/u/DineshNaik)\
**Post date:** [June 4, 2022, 1:36am UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/7 "2022-06-04T01:36:02Z")

</div>

What's the http.port value in your Elasticsearch yaml file ?

Kindly share the Elasticsearch yaml file content as well.

---

<div class="post-metadata">

**Author:** ![DineshNaik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dineshnaik/32/89308_2.png) [@DineshNaik](https://discuss.elastic.co/u/DineshNaik)\
**Post date:** [June 4, 2022, 1:38am UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/8 "2022-06-04T01:38:06Z")

</div>

Also please check below thread once :

> <https://stackoverflow.com/questions/58656747/elasticsearch-job-for-elasticsearch-service-failed>

---

<div class="post-metadata">

**Author:** ![Konstantina\_Gerou](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/konstantina_gerou/32/106574_2.png) [@Konstantina\_Gerou](https://discuss.elastic.co/u/Konstantina_Gerou)\
**Post date:** [June 6, 2022, 7:14am UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/9 "2022-06-06T07:14:33Z")

</div>

Unfortunatelly, it did not helped me.  
This is the elasticsearch.yml file.

# ======================== Elasticsearch Configuration =========================

# 

# NOTE: Elasticsearch comes with reasonable defaults for most settings.

# Before you set out to tweak and tune the configuration, make sure you

# understand what are you trying to accomplish and the consequences.

# 

# The primary way of configuring a node is via this file. This template lists

# the most important settings you may want to configure for a production cluster.

# 

# Please consult the documentation for further information on configuration options:

# [Elasticsearch Guide | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/index.html)

# 

# ---------------------------------- Cluster -----------------------------------

# 

# Use a descriptive name for your cluster:

# 

#cluster.name: my-application

# 

# ------------------------------------ Node ------------------------------------

# 

# Use a descriptive name for the node:

# 

#node.name: node-1

# 

# Add custom attributes to the node:

# 

#node.attr.rack: r1

# 

# ----------------------------------- Paths ------------------------------------

# 

# Path to directory where to store the data (separate multiple locations by comma):

# 

path.data: /var/lib/elasticsearch

# 

# Path to log files:

# 

path.logs: /var/log/elasticsearch

# 

# ----------------------------------- Memory -----------------------------------

# 

# Lock the memory on startup:

# 

#bootstrap.memory\_lock: true

# 

# Make sure that the heap size is set to about half the memory available

# on the system and that the owner of the process is allowed to use this

# limit.

# 

# Elasticsearch performs poorly when the system is swapping the memory.

# 

# ---------------------------------- Network -----------------------------------

# 

# By default Elasticsearch is only accessible on localhost. Set a different

# address here to expose this node on the network:

# 

network.host: 127.0.0.1

# 

# By default Elasticsearch listens for HTTP traffic on the first free port it

# finds starting at 9200. Set a specific HTTP port here:

# 

http.port: 9200

# 

# For more information, consult the network module documentation.

# 

# --------------------------------- Discovery ----------------------------------

# 

# Pass an initial list of hosts to perform discovery when this node is started:

# The default list of hosts is ["127.0.0.1", "[::1]"]

discovery.seed\_hosts:   
#ompressed class space mapped at: 0x0000000100000000-0x0000000140000000, reserved size: 1073741824  
#[2022-05-31T13:45:21.243+0000][47882][gc,metaspace] Narrow klass base: 0x0000000000000000, Narrow klass shift: 3, Narrow klas range 0x140000000  
#[2022-05-31T13:45:21.315+0000][47882][gc,heap,exit] Heap  
#[2022-05-31T13:45:21.315+0000][47882][gc,heap,exit] garbage-first heap total 1964032K, used 1538K [0x0000000088200000, 0x0000000100000000)  
#[2022-05-31T13:45:21.315+0000][47882][gc,heap,exit] region size 1024K, 2 young (2048K), 0 survivors (OK)  
#[2022-05-31T13:45:21.315+0000][47882][gc,heap,exit] Metaspace used 3474K, committed 3584K, reserved 1114112K  
#[2022-05-31T13:45:21.315+0000][47882][gc,heap,exit] class space used 263K, committed 320K, reserved 1048576K  
#discovery.seed\_hosts: ["host1", "host2"]

# 

# Bootstrap the cluster using an initial set of master-eligible nodes:

# 

#cluster.initial\_master\_nodes: ["node-1", "node-2"]

# 

# 

# For more information, consult the discovery and cluster formation module documentation.

# 

# ---------------------------------- Various -----------------------------------

# 

# Require explicit names when deleting indices:

# 

#action.destructive\_requires\_name: true

# 

# ---------------------------------- Security ----------------------------------

# 

# \*\*\* WARNING \*\*\*

# 

# Elasticsearch security features are not enabled by default.

# These features are free, but require configuration changes to enable them.

# This means that users don’t have to provide credentials and can get full access

# to the cluster. Network connections are also not encrypted.

# 

# To protect your data, we strongly encourage you to enable the Elasticsearch security features.

# Refer to the following documentation for instructions.

# 

# [Configure security for the Elastic Stack | Elasticsearch Guide [7.16] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.16/configuring-stack-security.html)

---

<div class="post-metadata">

**Author:** ![Konstantina\_Gerou](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/konstantina_gerou/32/106574_2.png) [@Konstantina\_Gerou](https://discuss.elastic.co/u/Konstantina_Gerou)\
**Post date:** [June 6, 2022, 7:25am UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/10 "2022-06-06T07:25:33Z")

</div>

And here is the jvm.options file.  
################################################################

## 

## JVM configuration

## 

################################################################

## 

## WARNING: DO NOT EDIT THIS FILE. If you want to override the

## JVM options in this file, or set any additional options, you

## should create one or more files in the jvm.options.d

## directory containing your adjustments.

## 

## See [Setting JVM options | Elasticsearch Guide [7.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/jvm-options.html)

## for more information.

## 

################################################################

################################################################

## IMPORTANT: JVM heap size

################################################################

## 

## The heap size is automatically configured by Elasticsearch

## based on the available memory in your system and the roles

## each node is configured to fulfill. If specifying heap is

## required, it should be done through a file in jvm.options.d,

## and the min and max should be set to the same value. For

## example, to set the heap to 4 GB, create a new file in the

## jvm.options.d directory containing these lines:

## 

-Xms512m  
-Xmx512m

## 

## See [Heap size settings | Elasticsearch Guide [7.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/heap-size.html)

## for more infionsP

################################################################

## Expert settings

################################################################

## 

## All settings below here are considered expert settings. Do

## not adjust them unless you understand what you are doing. Do

## not edit them in this file; instead, create a new file in the

## jvm.options.d directory containing your adjustments.

## 

################################################################

## GC configuration

8-13:-XX:+UseConcMarkSweepGC  
8-13:-XX:CMSInitiatingOccupancyFraction=75  
8-13:-XX:+UseCMSInitiatingOccupancyOnly

## G1GC Configuration

# NOTE: G1 GC is only supported on JDK version 10 or later

# to use G1GC, uncomment the next two lines and update the version on the

# following three lines to your version of the JDK

# 10-13:-XX:-UseConcMarkSweepGC

# 10-13:-XX:-UseCMSInitiatingOccupancyOnly

14-:-XX:+UseG1GC

## JVM temporary directory

-Djava.io.tmpdir=${ES\_TMPDIR}

## heap dumps

# generate a heap dump when an allocation from the Java heap fails; heap dumps

# are created in the working directory of the JVM unless an alternative path is

# specified

-XX:+HeapDumpOnOutOfMemoryError

# exit right after heap dump on out of memory error. Recommended to also use

# on java 8 for supported versions (8u92+).

9-:-XX:+ExitOnOutOfMemoryError

# specify an alternative path for heap dumps; ensure the directory exists and

# has sufficient space

-XX:HeapDumpPath=/var/lib/elasticsearch

# specify an alternative path for JVM fatal error logs

-XX:ErrorFile=/var/log/elasticsearch/hs\_err\_pid%p.log

## JDK 8 GC logging

8:-XX:+PrintGCDetails  
8:-XX:+PrintGCDateStamps  
8:-XX:+PrintTenuringDistribution  
8:-XX:+PrintGCApplicationStoppedTime  
8:-Xloggc:/var/log/elasticsearch/gc.log  
8:-XX:+UseGCLogFileRotation  
8:-XX:NumberOfGCLogFiles=32  
8:-XX:GCLogFileSize=64m

# JDK 9+ GC logging

9-:-Xlog:gc\*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m

---

<div class="post-metadata">

**Author:** ![Konstantina\_Gerou](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/konstantina_gerou/32/106574_2.png) [@Konstantina\_Gerou](https://discuss.elastic.co/u/Konstantina_Gerou)\
**Post date:** [June 6, 2022, 9:46am UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/11 "2022-06-06T09:46:37Z")

</div>

I solved it. I just did: chown -R Elasticsearch:Elasticsearch /etc/Elasticsearch

---

<div class="post-metadata">

**Author:** ![DineshNaik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dineshnaik/32/89308_2.png) [@DineshNaik](https://discuss.elastic.co/u/DineshNaik)\
**Post date:** [June 6, 2022, 11:19am UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/12 "2022-06-06T11:19:07Z")

</div>

Good to know @Konstantina_Gerou 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 4, 2022, 11:19am UTC](https://discuss.elastic.co/t/magento2-elasticsearch-failed-to-start-problem-with-java/306321/13 "2022-07-04T11:19:15Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
