You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Decarbon <ky...@gmail.com> on 2024/01/19 21:05:21 UTC

Apache Tomcat Windows Service fails when running in OpenJDK 11

Hi all,

I have been installing and running a Windows Service using Tomcat 9.0.83 on
OpenJDK 8 just fine. But when I moved to OpenJDK 11, specifically
microsoft-jdk-11.0.21-windows-x64.zip, the Service always fails to start
with the following error logged in commons-daemon.log:
[2024-01-19 15:39:03] [info]  [15344] Apache Commons Daemon procrun
(1.3.4.0 64-bit) started.
[2024-01-19 15:39:03] [info]  [15344] Running Service 'FFBruh'...
[2024-01-19 15:39:03] [info]  [15636] Starting service...
[2024-01-19 15:39:03] [error] [18700] CreateJavaVM Failed with error [-6]
[2024-01-19 15:39:03] [error] [18700] The system cannot find the file
specified.
[2024-01-19 15:39:03] [error] [15636] Failed to start Java
[2024-01-19 15:39:03] [error] [15636] ServiceStart returned 4.
[2024-01-19 15:39:03] [info]  [15344] Run service finished.
[2024-01-19 15:39:03] [info]  [15344] Apache Commons Daemon procrun
finished.

The service is installed as follows:

C:\app\bin\tomcat9.exe //IS//%SERVICE_NAME% ^
    --Description "Some Desc" ^
    --DisplayName "Display Name" ^
    --Install "C:\app\bin\tomcat9.exe" ^
    --LogPath "%CATALINA_BASE%\logs" ^
    --StdOutput auto ^
    --StdError auto ^
    --Classpath "%CLASSPATH%" ^
    --Jvm "%JVM%" ^
    --StartMode jvm ^
    --StopMode jvm ^
    --StartPath "%CATALINA_HOME%" ^
    --StopPath "%CATALINA_HOME%" ^
    --StartClass org.apache.catalina.startup.Bootstrap ^
    --StopClass org.apache.catalina.startup.Bootstrap ^
    --StartParams start ^
    --StopParams stop ^
     --Startup auto ^
     --JvmMs %INIT_MEMORY_POOL_SIZE% ^
     --JvmMx %MAX_MEMORY_POOL_SIZE% ^
     --JvmSs %STACK_SIZE% ^
     --Environment "ksp=%KSP%" ^
     --StartPath "%CATALINA_HOME%" ^
     --JvmOptions9 "some long list of -D options"

One thing to note is that, with OpenJDK 8, the JRE was included in the JDK
but from OpenJDK 11 they have removed it and is not part of the JDK.
Therefore, with 8 the --Jvm flag was pointing to
C:\app\java\jre\bin\jvm.dll but now after the upgrade it is
C:\app\java\bin\jvm.dll

Looking for your advice here.
Thanks!
Decarbon

Re: Apache Tomcat Windows Service fails when running in OpenJDK 11

Posted by Decarbon <ky...@gmail.com>.
On Fri, Jan 19, 2024 at 4:13 PM Decarbon <ky...@gmail.com> wrote:

> On Fri, Jan 19, 2024 at 4:05 PM Decarbon <ky...@gmail.com>
> wrote:
>
>> Hi all,
>>
>> I have been installing and running a Windows Service using Tomcat 9.0.83
>> on OpenJDK 8 just fine. But when I moved to OpenJDK 11, specifically
>> microsoft-jdk-11.0.21-windows-x64.zip, the Service always fails to start
>> with the following error logged in commons-daemon.log:
>> [2024-01-19 15:39:03] [info]  [15344] Apache Commons Daemon procrun
>> (1.3.4.0 64-bit) started.
>> [2024-01-19 15:39:03] [info]  [15344] Running Service 'FFBruh'...
>> [2024-01-19 15:39:03] [info]  [15636] Starting service...
>> [2024-01-19 15:39:03] [error] [18700] CreateJavaVM Failed with error [-6]
>> [2024-01-19 15:39:03] [error] [18700] The system cannot find the file
>> specified.
>> [2024-01-19 15:39:03] [error] [15636] Failed to start Java
>> [2024-01-19 15:39:03] [error] [15636] ServiceStart returned 4.
>> [2024-01-19 15:39:03] [info]  [15344] Run service finished.
>> [2024-01-19 15:39:03] [info]  [15344] Apache Commons Daemon procrun
>> finished.
>>
>> The service is installed as follows:
>>
>> C:\app\bin\tomcat9.exe //IS//%SERVICE_NAME% ^
>>     --Description "Some Desc" ^
>>     --DisplayName "Display Name" ^
>>     --Install "C:\app\bin\tomcat9.exe" ^
>>     --LogPath "%CATALINA_BASE%\logs" ^
>>     --StdOutput auto ^
>>     --StdError auto ^
>>     --Classpath "%CLASSPATH%" ^
>>     --Jvm "%JVM%" ^
>>     --StartMode jvm ^
>>     --StopMode jvm ^
>>     --StartPath "%CATALINA_HOME%" ^
>>     --StopPath "%CATALINA_HOME%" ^
>>     --StartClass org.apache.catalina.startup.Bootstrap ^
>>     --StopClass org.apache.catalina.startup.Bootstrap ^
>>     --StartParams start ^
>>     --StopParams stop ^
>>      --Startup auto ^
>>      --JvmMs %INIT_MEMORY_POOL_SIZE% ^
>>      --JvmMx %MAX_MEMORY_POOL_SIZE% ^
>>      --JvmSs %STACK_SIZE% ^
>>      --Environment "ksp=%KSP%" ^
>>      --StartPath "%CATALINA_HOME%" ^
>>      --JvmOptions9 "some long list of -D options"
>>
>> One thing to note is that, with OpenJDK 8, the JRE was included in the
>> JDK but from OpenJDK 11 they have removed it and is not part of the JDK.
>> Therefore, with 8 the --Jvm flag was pointing to
>> C:\app\java\jre\bin\jvm.dll but now after the upgrade it is
>> C:\app\java\bin\jvm.dll
>>
>> Looking for your advice here.
>> Thanks!
>> Decarbon
>>
>
> Small correction, the path to %JVM% was C:\app\java\jre\bin\server\jvm.dll
> and now with OpenJDK 11 C:\app\java\bin\server\jvm.dll
>

I was able to solve the problem, turns out one of the JVM options I had was
-Djava.endorsed.dirs which was removed from JDK 11 and was causing the
service to fail to start.
Removing the options fixes the issue.

Re: Apache Tomcat Windows Service fails when running in OpenJDK 11

Posted by Decarbon <ky...@gmail.com>.
On Fri, Jan 19, 2024 at 4:05 PM Decarbon <ky...@gmail.com> wrote:

> Hi all,
>
> I have been installing and running a Windows Service using Tomcat 9.0.83
> on OpenJDK 8 just fine. But when I moved to OpenJDK 11, specifically
> microsoft-jdk-11.0.21-windows-x64.zip, the Service always fails to start
> with the following error logged in commons-daemon.log:
> [2024-01-19 15:39:03] [info]  [15344] Apache Commons Daemon procrun
> (1.3.4.0 64-bit) started.
> [2024-01-19 15:39:03] [info]  [15344] Running Service 'FFBruh'...
> [2024-01-19 15:39:03] [info]  [15636] Starting service...
> [2024-01-19 15:39:03] [error] [18700] CreateJavaVM Failed with error [-6]
> [2024-01-19 15:39:03] [error] [18700] The system cannot find the file
> specified.
> [2024-01-19 15:39:03] [error] [15636] Failed to start Java
> [2024-01-19 15:39:03] [error] [15636] ServiceStart returned 4.
> [2024-01-19 15:39:03] [info]  [15344] Run service finished.
> [2024-01-19 15:39:03] [info]  [15344] Apache Commons Daemon procrun
> finished.
>
> The service is installed as follows:
>
> C:\app\bin\tomcat9.exe //IS//%SERVICE_NAME% ^
>     --Description "Some Desc" ^
>     --DisplayName "Display Name" ^
>     --Install "C:\app\bin\tomcat9.exe" ^
>     --LogPath "%CATALINA_BASE%\logs" ^
>     --StdOutput auto ^
>     --StdError auto ^
>     --Classpath "%CLASSPATH%" ^
>     --Jvm "%JVM%" ^
>     --StartMode jvm ^
>     --StopMode jvm ^
>     --StartPath "%CATALINA_HOME%" ^
>     --StopPath "%CATALINA_HOME%" ^
>     --StartClass org.apache.catalina.startup.Bootstrap ^
>     --StopClass org.apache.catalina.startup.Bootstrap ^
>     --StartParams start ^
>     --StopParams stop ^
>      --Startup auto ^
>      --JvmMs %INIT_MEMORY_POOL_SIZE% ^
>      --JvmMx %MAX_MEMORY_POOL_SIZE% ^
>      --JvmSs %STACK_SIZE% ^
>      --Environment "ksp=%KSP%" ^
>      --StartPath "%CATALINA_HOME%" ^
>      --JvmOptions9 "some long list of -D options"
>
> One thing to note is that, with OpenJDK 8, the JRE was included in the JDK
> but from OpenJDK 11 they have removed it and is not part of the JDK.
> Therefore, with 8 the --Jvm flag was pointing to
> C:\app\java\jre\bin\jvm.dll but now after the upgrade it is
> C:\app\java\bin\jvm.dll
>
> Looking for your advice here.
> Thanks!
> Decarbon
>

Small correction, the path to %JVM% was C:\app\java\jre\bin\server\jvm.dll
and now with OpenJDK 11 C:\app\java\bin\server\jvm.dll