I implement a custom ServletContextListener
and place the breakpoints on both the contextInitialized()
and contextDestroyed()
.
When starting the web application using WTP , contextInitialized()
can be stopped by the debugger. But when I shut down the web application , the breakpoints in the contextDestroyed()
do not work and the web application just shutdown . Is it possible and how to use debugger to debug contextDestroyed()
in eclipse ?
I want to check if the resource used can be released properly during the shut-down of the web application.
Breakpoints To define a breakpoint in your source code, right-click in the left margin in the Java editor and select Toggle Breakpoint. Alternatively, you can double-click on this position. The Breakpoints view allows you to delete and deactivate Breakpoints and modify their properties.
Press F8 (which is also Resume button),that will take you to the break point. From there debug each line with F6. If you want to go to next break point press F8.
The contextDestroyed()
will only be called when you gracefully shuts down the server by opening the Servers view and rightclicking the server instance and choosing Stop, or by hitting the red button in the Servers view whose tooltip says Stop the server.
It will not be called when you terminate the server altogether by hitting the red button in the Console view whose tooltip says Terminate. Terminating (killing) is not the same as stopping.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With