[JAVA] Solution for Apache Tomcat 8 not starting after changing to OpenJDK 11

Overview

Until now, Apache Tomcat 8 was running on Oracle JDK 8, but it has been replaced with OpenJDK 11 due to the support of the JDK version upgrade. Then, the following error message was displayed in the Apache Tomcat log and it could not be started. I had a hard time fixing the error, so I will describe the solution.

[2018-10-16 02:18:51] [info]  ( prunsrv.c:1175) [ 3808] Starting service...
・ ・ ・(Abbreviation)・ ・ ・
[2018-10-16 02:18:56] [error]( javajni.c:763 ) [ 3816] CreateJavaVM Failed
[2018-10-16 02:18:56] [error]( javajni.c:763 ) [ 3816]The specified file could not be found.
[2018-10-16 02:18:57] [debug]( javajni.c:1013) [ 3816] Java Worker thread finished : with status = 2
[2018-10-16 02:18:57] [error]( prunsrv.c:1232) [ 3808] Failed to start Java
[2018-10-16 02:18:57] [error]( prunsrv.c:1580) [ 3808] ServiceStart returned 4
[2018-10-16 02:18:57] [debug]( prunsrv.c:885 ) [ 3808] reportServiceStatusE: dwCurrentState = 1, dwWin32ExitCode = 1066, dwWaitHint = 0, dwServiceSpecificExitCode = 4
[2018-10-16 02:18:58] [info]  ( prunsrv.c:1645) [ 3780] Run service finished.
[2018-10-16 02:18:58] [info]  ( prunsrv.c:1814) [ 3780] Commons Daemon procrun finished
<JAVA_HOME>/lib/endorsed is not supported. Endorsed standards and standalone APIs
in modular form will be supported via the concept of upgradeable modules.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Solution

If the JVM Option of Apache Tomcat contains java.endorsed.dirs, Java will fail to start in JDK 9 and later. Therefore, if it is included, the line must be deleted.

-Djava.endorsed.dirs=C:\Program Files\ApacheTomcat\endorsed

In Windows environment, you can change the JVM Option of Apache Tomcat from the following registry key.

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\Tomcat8\Parameters\Java\Options

In addition, please note that Apache Tomcat will fail to start even if the following conditions are met.

Reference: https://docs.oracle.com/javase/jp/9/migrate/toc.htm

Recommended Posts

Solution for Apache Tomcat 8 not starting after changing to OpenJDK 11
Solution when java completion candidate does not appear after updating to eclipse 2018-12
Workaround for GMO VPS (CentOS8.1) not being able to start after yum update