title: Eclipse, Hibernate 5.0.7 Locked on debug mode
body: <p>I have a problem with my web application. This is the context:</p>
  <ul>
  <li>Eclispe 2021-09</li>
  <li>Tomcat 9.0.44</li>
  <li>Java 11.0.12</li>
  </ul>
  <p>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.</p>
  <p>This is the <code>HibernateSessionRequestFilter.java</code>:</p>
  <p><a href="https://i.stack.imgur.com/6b1sT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6b1sT.png" alt="HIbernateSessionRequestFilter.java" /></a>
  The lock is on line 27:</p>
  <pre><code>HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
  </code></pre>
  <p>Analyzing in debug that call, I can see that the application remains locked on the line</p>
  <pre><code>final Metadata metadata = metadataBuilder.build();
  </code></pre>
  <p>of class <em>Configuration</em>.</p>
  <p><a href="https://i.stack.imgur.com/SyvlM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SyvlM.png" alt="enter image description here" /></a></p>
  <p>I noticed that when I stop Tomcat it stop immediately and it throws an error:</p>
  <pre><code>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
  </code></pre>
  <p>Is it possible that Eclipse doesn't stop correctly Tomcat? I tried to stop it using <em>shutdown.bat</em> 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.</p>
  <p>I've noticed that this problem occurr only in debug mode, the run mode works correctly.</p>
  <p>Thanks in advance.</p>