So I've downloaded and installed Tomcat10 service with:
PS C:\apache-tomcat-10.1.7\bin> .\service.bat install
and I can see it in my Services Windows page:
I've added two env vars:
PS C:\apache-tomcat-10.1.7\bin> $env:CATALINA_HOME
C:\apache-tomcat-10.1.7
PS C:\apache-tomcat-10.1.7\bin> $env:CATALINA_BASE
C:\apache-tomcat-10.1.7\instances\instance1
plus I've added %CATALINA_HOME%\bin
to PATH
env var
but when I give:
start tomcat10
a cli window opens for a split second, then closes.
I go look at the services page and tomcat service is not started, evidence also here:
PS C:\WINDOWS\system32> Get-Service tomcat10
Status Name DisplayName
------ ---- -----------
Stopped tomcat10 Apache Tomcat 10.1 Tomcat10
I've looked around, and found this SO question and I've changed the startup and shutdown from jvm to java but it didn't work.
So I looked at the logs:
[2023-04-05 10:55:42] [info] [ 6304] Apache Commons Daemon procrun (1.3.3.0 64-bit) started.
[2023-04-05 10:55:42] [info] [ 6304] Running Service 'Tomcat10'...
[2023-04-05 10:55:42] [info] [ 6488] Starting service...
[2023-04-05 10:55:42] [error] [ 6488] Invalid JVM DLL handle.
[2023-04-05 10:55:43] [error] [ 6488] Impossibile trovare il modulo specificato.
[2023-04-05 10:55:43] [error] [ 6488] Impossibile trovare il modulo specificato.
[2023-04-05 10:55:43] [error] [ 6488] Failed to load JVM DLL '(null)', home '(null)'.
[2023-04-05 10:55:43] [error] [ 6488] Impossibile trovare il modulo specificato.
[2023-04-05 10:55:43] [error] [ 6488] Failed creating Java '(null)'.
[2023-04-05 10:55:43] [error] [ 6488] Impossibile trovare il modulo specificato.
[2023-04-05 10:55:43] [error] [ 6488] ServiceStart returned 1.
[2023-04-05 10:55:43] [error] [ 6488] Impossibile trovare il modulo specificato.
[2023-04-05 10:55:43] [info] [ 6304] Run service finished.
So I did override the defaul jvm.dll
location to the one of Java 8 (the one I use):
Started the service again and in commons-daemons.2023-04-05.log
I get:
[2023-04-05 11:36:31] [info] [24996] Apache Commons Daemon procrun (1.3.3.0 64-bit) started.
[2023-04-05 11:36:31] [info] [24996] Running Service 'Tomcat10'...
[2023-04-05 11:36:31] [info] [15668] Starting service...
[2023-04-05 11:36:31] [info] [15668] Service started in 8 milliseconds.
[2023-04-05 11:36:31] [info] [24996] Run service finished.
[2023-04-05 11:36:31] [info] [24996] Apache Commons Daemon procrun finished.
[2023-04-05 11:37:10] [info] [17896] Apache Commons Daemon procrun (1.3.3.0 64-bit) started.
[2023-04-05 11:37:10] [info] [17896] Running Service 'Tomcat10'...
[2023-04-05 11:37:10] [info] [ 6052] Starting service...
[2023-04-05 11:37:10] [info] [ 6052] Service started in 6 milliseconds.
[2023-04-05 11:37:10] [info] [17896] Run service finished.
[2023-04-05 11:37:10] [info] [17896] Apache Commons Daemon procrun finished.
but the service is still down... and looking at tomcat10-stderr.2023-04-05.log
I have:
Exception in thread "main"
2023-04-05 11:37:10 Apache Commons Daemon procrun stderr initialized.
java.lang.UnsupportedClassVersionError: org/apache/catalina/startup/Bootstrap has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main"
which, I guess, means it didn't like the jvm I set up for it in the last step... help me out here pls.