> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: Stopping a Timer in contextDestroyed() to avoid memory > leaks results in a NullPointerException > > I'd bet that Tomcat's "stop leaks" procedure is clearing-out a > static Timer reference and /then/ the ServletContextListener is > trying to access it.
No, it's because the same class was used as both a servlet and a listener, and the field holding the timer reference was not static. Tomcat instantiates separate objects for the servlet and listener; the timer reference was set in the servlet instance, but still void in the listener instance. An example of why not to do asymmetrical programming. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.