Java – debug servletcontextlistener by setting breakpoints in eclipse contextDestroyed()
I implemented a custom servletcontextlistener and placed breakpoints on contextinitialized () and contextdestroyed ()
When launching a web application using WTP, the debugger can stop contextinitialized() But when I close the web application, the breakpoint in contextdestroyed () doesn't work, and the web application closes Is it possible and how to use the debugger to debug contextdestroyed () in eclipse?
I want to check whether the resources used can be released correctly during the closing of the web application
Solution
Contextdestroyed() is called only when the server is shut down normally by opening the servers view and right clicking the server instance and selecting stop, or by clicking the red button of the tooltip stop server in the servers view
It will not be called when the server is completely terminated by clicking the red button that displays terminate in the tooltip in the console view Ending (killing) is different from stopping