Elasticsearch service failed start java.lang.NoClassDefFoundError: java/sql/Date

Environment:Windows Server 2019 Standard (64-bit, 8GB)

java version :"12.0.1" 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)

Elasticsearch version:7.2.0
service is installed success,but start failed.

PS C:\Elastic\elasticsearch-7.2.0> .\bin\elasticsearch-service install
Installing service      :  "elasticsearch-service-x64"
Using JAVA_HOME (64-bit):  "C:\Program Files\Java\jdk-12.0.1"
........
The service 'elasticsearch-service-x64' has been installed.

PS C:\Elastic\elasticsearch-7.2.0> .\bin\elasticsearch-service start
Failed starting 'elasticsearch-service-x64' service

log:elasticsearch-service-x64-stderr.2019-07-08.log

Failed to delete service
2019-07-08 17:40:22 Commons Daemon procrun stderr initialized
java.lang.NoClassDefFoundError: java/sql/Date
	at org.yaml.snakeyaml.nodes.Tag.<clinit>(Tag.java:64)
	at org.yaml.snakeyaml.resolver.Resolver.addImplicitResolvers(Resolver.java:54)
	at org.yaml.snakeyaml.resolver.Resolver.<init>(Resolver.java:74)
	at com.fasterxml.jackson.dataformat.yaml.YAMLParser.<init>(YAMLParser.java:101)
	at com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createParser(YAMLFactory.java:420)
	at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:321)
	at org.elasticsearch.common.xcontent.yaml.YamlXContent.createParser(YamlXContent.java:85)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1087)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1070)
	at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:83)
	at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:95)
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
	at org.elasticsearch.cli.Command.main(Command.java:90)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
Caused by: java.lang.ClassNotFoundException: java.sql.Date
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 16 more

Failed to start service

elasticsearch-service-x64.2019-07-08

[2019-07-08 17:40:15] [info]  [ 1656] Commons Daemon procrun (1.1.0.0 64-bit) started
[2019-07-08 17:40:15] [info]  [ 1656] Service elasticsearch-service-x64 name Elasticsearch 7.2.0 (elasticsearch-service-x64)
[2019-07-08 17:40:15] [info]  [ 1656] Service 'elasticsearch-service-x64' installed
[2019-07-08 17:40:15] [info]  [ 1656] Commons Daemon procrun finished
[2019-07-08 17:40:22] [info]  [ 6760] Commons Daemon procrun (1.1.0.0 64-bit) started
[2019-07-08 17:40:22] [info]  [ 6760] Starting service 'elasticsearch-service-x64' ...
[2019-07-08 17:40:22] [info]  [ 6800] Commons Daemon procrun (1.1.0.0 64-bit) started
[2019-07-08 17:40:22] [info]  [ 6800] Running 'elasticsearch-service-x64' Service...
[2019-07-08 17:40:22] [info]  [ 6176] Starting service...
[2019-07-08 17:40:23] [info]  [ 6176] Service started in 1424 ms.
[2019-07-08 17:40:23] [info]  [ 6800] Run service finished.
[2019-07-08 17:40:23] [info]  [ 6800] Commons Daemon procrun finished
[2019-07-08 17:40:25] [error] [ 6760] apxServiceControl(): dwState(4) != dwCurrentState(1); dwWin32ExitCode = 1066, dwWaitHint = 0, dwServiceSpecificExitCode = 1
[2019-07-08 17:40:25] [error] [ 6760] apxServiceControl(): returning FALSE
[2019-07-08 17:40:25] [error] [ 6760] Failed to start service 'elasticsearch-service-x64'
[2019-07-08 17:40:25] [info]  [ 6760] Start service finished, returning 0
[2019-07-08 17:40:25] [error] [ 6760] Commons Daemon procrun failed with exit value: 5 (Failed to start service)

I found the reason, the service can not use the jre12, when i uninstall the jre12 and use the jre8.
And I use the server jre version :download link
The service can be started without any problem.

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