Debug ServletContextListener.contextDestroyed () by setting a breakpoint in eclipse

I implement a custom ServletContextListener and place breakpoints on both contextInitialized() and contextDestroyed() .

When starting a web application using WTP, contextInitialized() can be stopped by the debugger. But when I close the web application, breakpoints in contextDestroyed() do not work, and the web application just shuts down. Is it possible and how to use the debugger to debug contextDestroyed() in eclipse?

I want to check if the dedicated resource can be used correctly while the web application is disconnecting.

+6
source share
1 answer

contextDestroyed() will be called only when you gracefully shut down the server by opening the Servers view and clicking on the server instance and selecting Stop, or by clicking the red button in the Servers view, in the Stop the server prompt.

It is not called when the server is completely shut down by pressing the red button in the console view, the prompt of which indicates Terminate. Stopping (killing) is not the same as stopping.

+12
source

Source: https://habr.com/ru/post/905610/


All Articles