Logstash not working with jdk 11.0.16

Hi @shivani_aggarwal

Ok I did a quick test I used CentoOS 7, the jdk you specified and the 7.17.3 oss logstash tar.gz not the rpm.... but it looks good... see below.

I suspect their is perhaps a different issue I see here like your LS_JAVA_HOME is not pointed correctly or perhaps this or this

23:20:50 chmod: cannot access '/etc/default/logstash': No such file or directory

Perhaps @Badger might have an Idea.. I am not much of a dockerfile guru for logstash I also see this

CentOS 7 Test

$ cat /etc/centos-release 
CentOS Linux release 7.9.2009 (Core)

$ sudo yum install java-11-openjdk-11.0.16.0.8

$ java -version
openjdk version "11.0.16" 2022-07-19 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.16.0.8-1.el7_9) (build 11.0.16+8-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.16.0.8-1.el7_9) (build 11.0.16+8-LTS, mixed mode, sharing

$ curl -O https://artifacts.elastic.co/downloads/logstash/logstash-oss-7.17.3-linux-x86_64.tar.gz

$ tar -xvf logstash-oss-7.17.3-linux-x86_64.tar.gz 

$ cd logstash-7.17.3/

$ export LS_JAVA_HOME=/etc/alternatives/jre_11_openjdk

$ ./bin/logstash -f config/logstash-sample.conf 
WARNING: Using LS_JAVA_HOME while Logstash distribution comes with a bundled JDK.
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Sending Logstash logs to /home/sbrown/logstash-7.17.3/logs which is now configured via log4j2.properties
[2022-09-26T17:19:47,907][INFO ][logstash.runner          ] Log4j configuration path used is: /home/sbrown/logstash-7.17.3/config/log4j2.properties
[2022-09-26T17:19:47,922][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"7.17.3", "jruby.version"=>"jruby 9.2.20.1 (2.5.8) 2021-11-30 2a2962fbd1 OpenJDK 64-Bit Server VM 11.0.16+8-LTS on 11.0.16+8-LTS +indy +jit [linux-x86_64]"}
[2022-09-26T17:19:47,926][INFO ][logstash.runner          ] JVM bootstrap flags: [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djruby.compile.invokedynamic=true, -Djruby.jit.threshold=0, -Djruby.regexp.interruptible=true, -XX:+HeapDumpOnOutOfMemoryError, -Djava.security.egd=file:/dev/urandom, -Dlog4j2.isThreadContextMapInheritable=true]
...
[2022-09-26T17:19:54,966][INFO ][logstash.agent           ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2022-09-26T17:19:55,157][INFO ][org.logstash.beats.Server][main][5237448ed2f0ac4548d75dd974c41e3cad2173b2c69b70448dadf43fa9fe28e0] Starting server on port: 5044