You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2005/02/09 12:32:50 UTC

DO NOT REPLY [Bug 33463] New: - Struts PlugIn.destroy() method not called when WebApp stopped in Tomcat 5.5.7

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33463>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33463

           Summary: Struts PlugIn.destroy() method not called when WebApp
                    stopped in Tomcat 5.5.7
           Product: Tomcat 5
           Version: 5.5.7
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: kap@apama.com
                CC: kap@apama.com


I have a Struts 1.1 application that has worked fine in Tomcat 4.1.x, 5.0.x, 
but does not function correctly under Tomcat 5.5.7.

Specifically, my Struts application registers a PlugIn class (which just 
implements the 2 methods of the interface, i.e. init() and destroy()).  The 
init() method is called just fine as the app is started, but the destroy() 
method is not called when the app is stopped.  We are using the Manager 
application to start and stop the web app.

This can be reproduced by simply adding a PlugIn implementation to the struts-
examples.war - see example plugin below.

Interestingly, the destroy method of a plain servlet IS called when the app is 
stopped (this is our workaround just now).  It would appear that when the 
Struts ActionServlet.destroyModules() method is called, it performs the 
following:
Enumeration names = getServletContext().getAttributeNames();
This enumeration is empty, and hence it is unable to notify the plugin.

Hope this is detailed enough.

For reference, this is on Win XP SP2, JRE 1.5.0_01, Tomcat 5.5.7, Struts 1.1


Cheers,

Kev Palfreyman
Apama UK Ltd.


Example PlugIn:

>From struts-config.xml:

	<plug-in className="ApamaDebugPlugIn"></plug-in>


import org.apache.struts.action.PlugIn;
import org.apache.struts.action.ActionServlet;
import javax.servlet.ServletException;
import org.apache.struts.config.ModuleConfig;

public class ApamaDebugPlugIn implements PlugIn {

	public void init(ActionServlet servlet, ModuleConfig config) throws 
ServletException {
		System.out.println("ApamaDebugPlugin.init()");
	} 


	public void destroy() {
		System.out.println("ApamaDebugPlugin.destroy()");
	}
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org