I have a problem with my web application. This is the context:
- Eclispe 2021-09
- Tomcat 9.0.44
- Java 11.0.12
When I start Eclipse and I run the web application in debug all works perfectly, but when I stop Tomcat and restart immediately the web application, always in debug, it seems locked on HibernateSessionRequestFilter.
This is the HibernateSessionRequestFilter.java:
HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
Analyzing in debug that call, I can see that the application remains locked on the line
final Metadata metadata = metadataBuilder.build();
of class Configuration.
I noticed that when I stop Tomcat it stop immediately and it throws an error:
WARNING: The web application [AlphaPickServer] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.base@11.0.12/java.lang.Object.wait(Native Method)
java.base@11.0.12/java.util.TimerThread.mainLoop(Timer.java:553)
java.base@11.0.12/java.util.TimerThread.run(Timer.java:506)
nov 11, 2021 9:53:05 AM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
Is it possible that Eclipse doesn't stop correctly Tomcat? I tried to stop it using shutdown.bat but with no different results. If I close and reopen Eclipse anything changes. If I restart PC, the first time, the debug starts with no problem.
I've noticed that this problem occurr only in debug mode, the run mode works correctly.
Thanks in advance.

