Trying to use Elasticsearch 7.17.1 as a service on a Windows Server 2016.
I run Elasticsearch-service manager and press Start from the GUI.
After a short while it stops. here is the debug log:
<
[2022-04-04 14:17:33] [debug] ( prunsrv.c:1729) [ 5472] Commons Daemon procrun log initialized
[2022-04-04 14:17:33] [info] ( prunsrv.c:1733) [ 5472] Commons Daemon procrun (1.1.0.0 64-bit) started
[2022-04-04 14:17:33] [info] ( prunsrv.c:1643) [ 5472] Running 'Elasticsearch-service-x64' Service...
[2022-04-04 14:17:33] [debug] ( prunsrv.c:1417) [ 7456] Inside ServiceMain...
[2022-04-04 14:17:33] [debug] ( prunsrv.c:885 ) [ 7456] reportServiceStatusE: dwCurrentState = 2, dwWin32ExitCode = 0, dwWaitHint = 3000, dwServiceSpecificExitCode = 0
[2022-04-04 14:17:33] [info] ( prunsrv.c:1175) [ 7456] Starting service...
[2022-04-04 14:17:33] [debug] ( javajni.c:236 ) [ 7456] loading jvm 'C:\Elasticsearch(7.17.1)\jdk\bin\server\jvm.dll'
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[0] -Des.networkaddress.cache.ttl=60
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[1] -Des.networkaddress.cache.negative.ttl=10
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[2] -XX:+AlwaysPreTouch
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[3] -Djava.awt.headless=true
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[4] -Dfile.encoding=UTF-8
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[5] -Djna.nosys=true
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[6] -XX:-OmitStackTraceInFastThrow
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[7] -XX:+ShowCodeDetailsInExceptionMessages
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[8] -Dio.netty.noUnsafe=true
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[9] -Dio.netty.noKeySetOptimization=true
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[10] -Dio.netty.recycler.maxCapacityPerThread=0
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[11] -Dio.netty.allocator.numDirectArenas=0
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[12] -Dlog4j.shutdownHookEnabled=false
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[13] -Dlog4j2.disable.jmx=true
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[14] -Dlog4j2.formatMsgNoLookups=true
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[15] -Djava.locale.providers=SPI,COMPAT
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[16] --add-opens=java.base/java.io=ALL-UNNAMED
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[17] -XX:+UseG1GC
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[18] -Djava.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\2\Elasticsearch
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[19] -XX:+HeapDumpOnOutOfMemoryError
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[20] -XX:+ExitOnOutOfMemoryError
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[21] -XX:HeapDumpPath=data
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[22] -XX:ErrorFile=logs/hs_err_pid%p.log
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[23] -XX:MaxDirectMemorySize=2147483648
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[24] -XX:G1HeapRegionSize=4m
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[25] -XX:InitiatingHeapOccupancyPercent=30
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[26] -XX:G1ReservePercent=15
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[27] -Delasticsearch
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[28] -Des.path.home=C:\Elasticsearch(7.17.1)
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[29] -Des.path.conf=C:\Elasticsearch(7.17.1)\config
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[30] -Des.distribution.flavor=default
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[31] -Des.distribution.type=zip
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[32] -Des.bundled_jdk=true
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[33] -Djava.class.path=C:\Elasticsearch(7.17.1)\lib\Elasticsearch-7.17.1.jar;C:\Elasticsearch(7.17.1)\lib\Elasticsearch-cli-7.17.1.jar;C:\Elasticsearch(7.17.1)\lib\Elasticsearch-core-7.17.1.jar;C:\Elasticsearch(7.17.1)\lib\Elasticsearch-geo-7.17.1.jar;C:\Elasticsearch(7.17.1)\lib\Elasticsearch-launchers-7.17.1.jar;C:\Elasticsearch(7.17.1)\lib\Elasticsearch-log4j-7.17.1.jar;C:\Elasticsearch(7.17.1)\lib\Elasticsearch-lz4-7.17.1.jar;C:\Elasticsearch(7.17.1)\lib\Elasticsearch-plugin-classloader-7.17.1.jar;C:\Elasticsearch(7.17.1)\lib\Elasticsearch-secure-sm-7.17.1.jar;C:\Elasticsearch(7.17.1)\lib\Elasticsearch-x-content-7.17.1.jar;C:\Elasticsearch(7.17.1)\lib\HdrHistogram-2.1.9.jar;C:\Elasticsearch(7.17.1)\lib\hppc-0.8.1.jar;C:\Elasticsearch(7.17.1)\lib\jackson-core-2.10.4.jar;C:\Elasticsearch(7.17.1)\lib\jackson-dataformat-cbor-2.10.4.jar;C:\Elasticsearch(7.17.1)\lib\jackson-dataformat-smile-2.10.4.jar;C:\Elasticsearch(7.17.1)\lib\jackson-dataformat-yaml-2.10.4.jar;C:\Elasticsearch(7.17.1)\lib\java-ver
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[34] exit
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[35] abort
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[36] -Xms4095m
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[37] -Xmx4095m
[2022-04-04 14:17:33] [debug] ( javajni.c:753 ) [ 8004] Jvm Option[38] -Xss1024k
[2022-04-04 14:17:35] [debug] ( javajni.c:937 ) [ 8004] argv[0] = --quiet
[2022-04-04 14:17:35] [debug] ( javajni.c:990 ) [ 8004] Java Worker thread started org/Elasticsearch/bootstrap/Elasticsearch:main
[2022-04-04 14:17:36] [debug] ( prunsrv.c:1235) [ 7456] Java started org/Elasticsearch/bootstrap/Elasticsearch
[2022-04-04 14:17:36] [info] ( prunsrv.c:1333) [ 7456] Service started in 3312 ms.
[2022-04-04 14:17:36] [debug] ( prunsrv.c:885 ) [ 7456] reportServiceStatusE: dwCurrentState = 4, dwWin32ExitCode = 0, dwWaitHint = 0, dwServiceSpecificExitCode = 0
[2022-04-04 14:17:36] [debug] ( prunsrv.c:1572) [ 7456] Waiting for worker to finish...
[2022-04-04 14:17:43] [debug] ( javajni.c:1001) [ 8004] Exception has been thrown
[2022-04-04 14:17:43] [debug] ( javajni.c:1013) [ 8004] Java Worker thread finished org/Elasticsearch/bootstrap/Elasticsearch:main with status = 6
[2022-04-04 14:17:43] [debug] ( prunsrv.c:1577) [ 7456] Worker finished.
/>
Guess "Exception has been thrown" is a trigger, but not much to go on!!
The System Event log has this entry for this error:
The Elasticsearch 7.17.1 (Elasticsearch-service-x64) service terminated with the following service-specific error:
Incorrect function.
As I previously ran Elasticsearch from the basic Bat file I know that ES_JAVA_HOME is set correctly.