That solution is not recommended, as the servlet container can decide to destroy the servlet at any time not onls at shutdown.
The official way is to use a ServletContextListener: http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContextListener.html > -----Urspr�ngliche Nachricht----- > Von: Nicholas Orr [mailto:[EMAIL PROTECTED]] > Gesendet: Mittwoch, 16. Oktober 2002 08:18 > An: 'Tomcat Users List' > Betreff: RE: Help in Tomcat4.x > > Use <load-on-startup> to start a servlet. > And in this servlet define the destroy method > public destroy() { > } > > -----Original Message----- > From: Santosh Kulkarni [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 16 October 2002 3:48 PM > To: [EMAIL PROTECTED] > Subject: Help in Tomcat4.x > > Is there any element similar to <load-on-startup> that > we can place in web.xml to invoke a servlet at the > shut-down of the web application/server. I want to > call a servlet when the Tomcat service is stopped. In > this servlet I want to release all the database > connections held. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
