When using your own setenv.sh/setenv.bat scripts to set your Tomcat environment, be sure to update the Java options...

JDK-17/JDK-21 Opens Error
Just a quick one today that will hopefully save you some time if you hit this yourself...
I'm updating a workspace to use JDK-21 (it was previously working fine w/ JDK-11).
When I started Tomcat, I immediately got an error:
10-Oct-2024 15:36:08.783 SEVERE [main] org.apache.catalina.startup.HostConfig.
deployDescriptor Error deploying deployment descriptor
[tomcat/conf/Catalina/localhost/ROOT.xml]
java.lang.IllegalStateException: Error starting child
[snip]
Caused by: org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
[snip]
Caused by: java.lang.ExceptionInInitializerError
at com.liferay.petra.reflect.ReflectionUtil.(ReflectionUtil.java:125)
at com.liferay.portal.kernel.util.ProxyUtil.(ProxyUtil.java:200)
[snip]
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field
static final java.lang.invoke.MethodHandles$Lookup
java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module
java.base does not "opens java.lang.invoke" to unnamed module @2f860823
[snip]
10-Oct-2024 15:36:08.798 INFO [main] org.apache.catalina.startup.Catalina.start
Server startup in [241] milliseconds
The key here, and the one that I hope Google is indexing and that's how you got here, is this exception:
java.lang.reflect.InaccessibleObjectException: Unable
to make field static final
java.lang.invoke.MethodHandles$Lookup
java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module
java.base does not "opens java.lang.invoke" to unnamed
module


