Unable to launch jar with apache commons daemon since java 17

171 views Asked by At

I already have an application in Java 8 which started correctly as a windows service with apache commons daemon. But recently by upgrading the application on java 17 I don't know why the application can't be started as a service.

Anyone have an idea of the problem? Below code for launching with NSIS installer:

ExecWait '$INSTDIR\MyServer-Service.exe //IS//MyServer-Service --Description="My Server Service" --Install=$INSTDIR\MyServer-Service.exe --Jvm=%JAVA_HOME% --Classpath=%CLASSPATH%;$INSTDIR\my-server.jar --StartMode=jvm --StartClass=com.crimson.core.CsLauncher --StartParams=-conf;$INSTDIR\conf\default.json --StopMode=jvm --StopClass=com.crimson.core.CsLauncher --StopMethod=stopService'

and logging by using servicew.exe:

[2023-10-20 11:45:13] [debug] ( prunsrv.c:2010) [27080] Apache Commons Daemon procrun log initialized.
[2023-10-20 11:45:13] [info]  ( prunsrv.c:2018) [27080] Apache Commons Daemon procrun (1.3.4.0 32-bit) started.
[2023-10-20 11:45:13] [info]  ( prunsrv.c:1922) [27080] Running Service 'My-ServerService'...
[2023-10-20 11:45:13] [debug] ( prunsrv.c:1681) [29020] Inside serviceMain()...
[2023-10-20 11:45:13] [debug] ( prunsrv.c:1127) [29020] reportServiceStatusE: dwCurrentState = 2 (SERVICE_START_PENDING), dwWin32ExitCode = 0, dwWaitHint = 3000 milliseconds, dwServiceSpecificExitCode = 0.
[2023-10-20 11:45:13] [info]  ( prunsrv.c:1426) [29020] Starting service...
[2023-10-20 11:45:13] [debug] ( javajni.c:216 ) [29020] Explicit RuntimeLib specified 'D:\Users\adrien\.jdks\openjdk-17.0.2\bin\server\jvm.dll'
[2023-10-20 11:45:13] [debug] ( javajni.c:285 ) [29020] Adding Java bin path to the PATH to fix loading of awt.dll: 'D:\Users\adrien\.jdks\openjdk-17.0.2\bin'
[2023-10-20 11:45:13] [debug] ( javajni.c:291 ) [29020] Loading JVM DLL 'D:\Users\adrien\.jdks\openjdk-17.0.2\bin\server\jvm.dll'
[2023-10-20 11:45:13] [error] ( javajni.c:300 ) [29020] Found 'D:\Users\adrien\.jdks\openjdk-17.0.2\bin\server\jvm.dll' but couldn't load it.
[2023-10-20 11:45:13] [error] ( javajni.c:300 ) [29020] %1 n’est pas une application Win32 valide.
[2023-10-20 11:45:13] [debug] ( javajni.c:321 ) [29020] Invalid JVM DLL handle.
[2023-10-20 11:45:13] [debug] ( javajni.c:322 ) [29020] Loading JVM DLL 'D:\Users\adrien\.jdks\openjdk-17.0.2\bin\server\jvm.dll' using LOAD_WITH_ALTERED_SEARCH_PATH.
[2023-10-20 11:45:13] [debug] ( javajni.c:326 ) [29020] Invalid JVM DLL handle.
[2023-10-20 11:45:13] [debug] ( javajni.c:329 ) [29020] Setting DLL search path to 'D:\Users\adrien\.jdks\openjdk-17.0.2\bin\server\jvm.dll'
[2023-10-20 11:45:13] [debug] ( javajni.c:332 ) [29020] Loading JVM DLL 'D:\Users\adrien\.jdks\openjdk-17.0.2\bin\server\jvm.dll'.
[2023-10-20 11:45:13] [debug] ( javajni.c:335 ) [29020] Invalid JVM DLL handle.
[2023-10-20 11:45:13] [debug] ( javajni.c:336 ) [29020] Loading JVM DLL 'D:\Users\adrien\.jdks\openjdk-17.0.2\bin\server\jvm.dll' using LOAD_WITH_ALTERED_SEARCH_PATH.
[2023-10-20 11:45:13] [error] ( javajni.c:343 ) [29020] Invalid JVM DLL handle.
[2023-10-20 11:45:13] [error] ( javajni.c:343 ) [29020] %1 n’est pas une application Win32 valide.
[2023-10-20 11:45:13] [error] ( javajni.c:344 ) [29020] %1 n’est pas une application Win32 valide.
[2023-10-20 11:45:13] [error] ( javajni.c:416 ) [29020] Failed to load JVM DLL 'D:\Users\adrien\.jdks\openjdk-17.0.2\bin\server\jvm.dll', home '(null)'.
[2023-10-20 11:45:13] [error] ( javajni.c:416 ) [29020] %1 n’est pas une application Win32 valide.
[2023-10-20 11:45:13] [error] ( prunsrv.c:1465) [29020] Failed creating Java 'D:\Users\adrien\.jdks\openjdk-17.0.2\bin\server\jvm.dll'.
[2023-10-20 11:45:13] [error] ( prunsrv.c:1465) [29020] %1 n’est pas une application Win32 valide.
[2023-10-20 11:45:13] [error] ( prunsrv.c:1854) [29020] ServiceStart returned 1.
[2023-10-20 11:45:13] [error] ( prunsrv.c:1854) [29020] %1 n’est pas une application Win32 valide.
[2023-10-20 11:45:13] [debug] ( prunsrv.c:1127) [29020] reportServiceStatusE: dwCurrentState = 1 (SERVICE_STOPPED), dwWin32ExitCode = 1066, dwWaitHint = 0 milliseconds, dwServiceSpecificExitCode = 1.
[2023-10-20 11:45:13] [info]  ( prunsrv.c:1924) [27080] Run service finished.
[2023-10-20 11:45:13] [info]  ( prunsrv.c:2102) [27080] Apache Commons Daemon procrun finished.

My Java home point exactly on the JDK 17 and I don't know why my service doesn't start

I expect a solution for starting correctly my service with JDK 17

0

There are 0 answers