facebook

Apache’s Tomcat vs MyEclipse’s Tomcat shutdown

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #253922 Reply

    Empty
    Member

    Hi all,
    I am running ME4.1.1GA on E3.1.2 with Tomcat 5.5.17 for developing a Struts 1.2 application with JavaSE 5.0_07. I created a custom ActionServlet, CustomActionServlet to use instead of Strut’s ActionServlet as I need to initialize and release resources on server startup and shutdown, respectively. When I start Tomcat (from within MyEclipse or using Tomcat Monitor), I see the logging within my init() method in my logs and console (plus my WebApp works which it wouldn’t if init() didn’t get called). When I stop the server (using MyEclipse’s Tomcat) I get a simple message saying “***This server has been successfully shutdown***” but I don’t see any destroy() logging within my console or in my log file. When I run Tomcat using Tomcat Monitor, I see the logging from my destroy() method on shutdown in their logs. I also don’t see:

    Jun 26, 2006 10:45:59 AM org.apache.coyote.http11.Http11AprProtocol pause
    INFO: Pausing Coyote HTTP/1.1 on http-8080
    Jun 26, 2006 10:45:59 AM org.apache.coyote.ajp.AjpAprProtocol pause
    INFO: Pausing Coyote AJP/1.3 on ajp-8009
    Jun 26, 2006 10:46:00 AM org.apache.catalina.core.StandardService stop
    INFO: Stopping service Catalina
    Jun 26, 2006 10:46:01 AM org.apache.coyote.http11.Http11AprProtocol destroy
    INFO: Stopping Coyote HTTP/1.1 on http-8080
    Jun 26, 2006 10:46:01 AM org.apache.coyote.ajp.AjpAprProtocol destroy
    INFO: Stopping Coyote AJP/1.3 on ajp-8009

    when using MyEclipse’s Tomcat in the logs or on the console but do see that from Tomcat’s logs when using Tomcat Monitor (nor is it running as a service when using MyEclipse).

    Also, I am running a JMS Broker on a ‘Data Warehouse’ on my back end that the web application gets it’s data from. When I shutdown Tomcat through MyEclipse I get a ‘connection reset’ error, which means that the connection was lost (not closed properly). Through regular Tomcat I get no error, which means the connection was closed properly.

    All this leads me to believe that the destroy() method is not being called through MyEclipse’s Tomcat for some reason (yet it is if I use Tomcat Monitor) and I was wondering if this is a bug or if there is some reason for this? I might just have something misconfigured or maybe my understanding of how ActionServlet.destroy() works is wrong but since the behavior I described above works _every_ time like I described (I have done several startups/shutdowns to make sure the behavior I’m seeing is not ambiguous) and it does seem like there are some difference’s between Apache’s Tomcat and MyEclipse’s Tomcat shutdown procedures I thought I’d post my problem here. I have Tomcat Monitor set to use the JRE instead of the JDK (like MyEclipse requires) and I am pointing my MyEclipse directories to the same location as Apache’s Tomcat. If anyone can shed some light on this it would be appreciated. I will throw in some code that might help.

    web.xml
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>tlc.fe.struts.londen.CustomActionServlet</servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>

    CustomActionServlet.java
    @Override
    public void destroy()
    {
    if( log.isDebugEnabled() ) log.debug( “destroy() – Entering” );

    super.destroy();

    DWConnectionFactory.close();
    if( log.isInfoEnabled() ) log.info( “destroy() – DWConnectionFactory was closed” );

    if( log.isDebugEnabled() ) log.debug( “destroy() – Exiting” );
    }

    Thanks,
    Ben Ludkiewicz

    #253925 Reply

    Empty
    Member

    I forgot to mention, I tried putting init() and destroy() in an implementation of org.apache.struts.action.PlugIn and had it called from struts-config.xml and I got the same behavior (init() called from startup on both both but destroy() not being called when stopping MyEclipse’s Tomcat).

    Ben

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Apache’s Tomcat vs MyEclipse’s Tomcat shutdown

You must be logged in to post in the forum log in