You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "CRANFORD, CHRIS" <Ch...@setech.com> on 2010/08/16 19:32:23 UTC

Destroying Context Listeners

I recently upgraded my Tomcat installation from 6.0.x to Tomcat 7
(Win64) and I am actively testing our current web applications for
backward compatibility, and so forth.  One of these web applications
creates a set of context listeners to manage various things during the
lifecycle of the web application.

During the startup of the web app, I do see that the
contextInitialized() method is called; however when either Tomcat is
stopped or restarted whether from the command line or via MyEclipse 8.6;
I do not see that contextDestroyed() is being invoked.  This is causing
some heartburn on our end with this particular web app and I cannot find
any solution.

Has anyone seen this and/or is this confirmed as a problem with Tomcat
7?
Or is there another expectation under Servlet 3.0 that I may have
overlooked.

Chris


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


RE: Destroying Context Listeners

Posted by "CRANFORD, CHRIS" <Ch...@setech.com>.
Upgrading to 7.0.2 resolved the issue, thanks!

> -----Original Message-----
> From: CRANFORD, CHRIS [mailto:Chris.Cranford@setech.com]
> Sent: Tuesday, August 17, 2010 10:23 AM
> To: Tomcat Users List
> Subject: RE: Destroying Context Listeners
> 
> Pid -
> 
> I will download the latest beta and give it a try.  When I realized
> what
> was going on, I simply commented out all the logic I had in the two
> methods and replaced them with the following:
> 
> public void contextDestroyed(ServletContextEvent arg) {
>   System.out.println("webapp listener context was destroyed.");
>   log.debug("contextDestroyed invoked successfully.");
> }
> 
> public void contextInitialized(ServletContextEvent arg) {
>   System.out.println("webapp listener context was initialized.");
>   log.debug("contextInitialized invoked successfully.");
> }
> 
> In my case, I saw the log entries for the initialization, but never
for
> destroy.
> 
> After I update to 7.0.2, I'll retest and let you know.
> 
> Chris
> 
> > -----Original Message-----
> > From: Pid [mailto:pid@pidster.com]
> > Sent: Tuesday, August 17, 2010 10:07 AM
> > To: Tomcat Users List
> > Subject: Re: Destroying Context Listeners
> >
> > On 17/08/2010 14:11, CRANFORD, CHRIS wrote:
> > > When I check the version of Tomcat 7, it says it is 7.0.0.0.
> > > It's the compiled version from 6/13/2010.
> >
> > Try downloading the latest beta, (or compile from trunk).
> >
> >  http://people.apache.org/~markt/dev/tomcat-7/v7.0.2/bin/
> >
> > > And yes, the log calls in the destroy method are never done, hence
> my
> >
> > It might seem like a silly question, but it's not always guaranteed
> > that
> > someone is using log messages to determine a fault.
> >
> > Is the log call the very first statement in the method?
> >
> > What kind of logging is it?  If it's a proper logging system and not
> a
> > System.out.println call, can you try with the latter instead?
> >
> >
> > p
> >
> >
> > > concern that it isn't being invoked.  Under Tomcat 6, these log
> > messages
> > > were captured and written indicating a successful execution of the
> > > method.  Even when I use a simple context listener that does a log
> > > message at startup and destroy times, only the startup one is
> > captured.
> > >
> > > Chris
> > >
> > >> -----Original Message-----
> > >> From: Pid [mailto:pid@pidster.com]
> > >> Sent: Tuesday, August 17, 2010 7:47 AM
> > >> To: Tomcat Users List
> > >> Subject: Re: Destroying Context Listeners
> > >>
> > >> On 16/08/2010 18:32, CRANFORD, CHRIS wrote:
> > >>>
> > >>> I recently upgraded my Tomcat installation from 6.0.x to Tomcat
7
> > >>> (Win64) and I am actively testing our current web applications
> for
> > >>> backward compatibility, and so forth.  One of these web
> > applications
> > >>> creates a set of context listeners to manage various things
> during
> > >> the
> > >>> lifecycle of the web application.
> > >>>
> > >>> During the startup of the web app, I do see that the
> > >>> contextInitialized() method is called; however when either
Tomcat
> > is
> > >>> stopped or restarted whether from the command line or via
> MyEclipse
> > >> 8.6;
> > >>> I do not see that contextDestroyed() is being invoked.  This is
> > >> causing
> > >>> some heartburn on our end with this particular web app and I
> cannot
> > >> find
> > >>> any solution.
> > >>>
> > >>> Has anyone seen this and/or is this confirmed as a problem with
> > >> Tomcat
> > >>> 7?
> > >>> Or is there another expectation under Servlet 3.0 that I may
have
> > >>> overlooked.
> > >>
> > >> Which exact version of Tomcat 7.0?
> > >>
> > >> Are you able to consistently reproduce this?
> > >>
> > >> What means are you using to determine that contextDestroyed() is
> not
> > >> called?  Log messages or... ?
> > >>
> > >>
> > >> p
> > >>
> > >>> Chris
> > >>>
> > >>>
> > >>>
> > >
> ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > >>> For additional commands, e-mail: users-help@tomcat.apache.org
> > >>>
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



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


RE: Destroying Context Listeners

Posted by "CRANFORD, CHRIS" <Ch...@setech.com>.
Pid -

I will download the latest beta and give it a try.  When I realized what
was going on, I simply commented out all the logic I had in the two
methods and replaced them with the following:

public void contextDestroyed(ServletContextEvent arg) {		
  System.out.println("webapp listener context was destroyed.");
  log.debug("contextDestroyed invoked successfully.");
}

public void contextInitialized(ServletContextEvent arg) {
  System.out.println("webapp listener context was initialized.");
  log.debug("contextInitialized invoked successfully.");
}	

In my case, I saw the log entries for the initialization, but never for
destroy.

After I update to 7.0.2, I'll retest and let you know.

Chris

> -----Original Message-----
> From: Pid [mailto:pid@pidster.com]
> Sent: Tuesday, August 17, 2010 10:07 AM
> To: Tomcat Users List
> Subject: Re: Destroying Context Listeners
> 
> On 17/08/2010 14:11, CRANFORD, CHRIS wrote:
> > When I check the version of Tomcat 7, it says it is 7.0.0.0.
> > It's the compiled version from 6/13/2010.
> 
> Try downloading the latest beta, (or compile from trunk).
> 
>  http://people.apache.org/~markt/dev/tomcat-7/v7.0.2/bin/
> 
> > And yes, the log calls in the destroy method are never done, hence
my
> 
> It might seem like a silly question, but it's not always guaranteed
> that
> someone is using log messages to determine a fault.
> 
> Is the log call the very first statement in the method?
> 
> What kind of logging is it?  If it's a proper logging system and not a
> System.out.println call, can you try with the latter instead?
> 
> 
> p
> 
> 
> > concern that it isn't being invoked.  Under Tomcat 6, these log
> messages
> > were captured and written indicating a successful execution of the
> > method.  Even when I use a simple context listener that does a log
> > message at startup and destroy times, only the startup one is
> captured.
> >
> > Chris
> >
> >> -----Original Message-----
> >> From: Pid [mailto:pid@pidster.com]
> >> Sent: Tuesday, August 17, 2010 7:47 AM
> >> To: Tomcat Users List
> >> Subject: Re: Destroying Context Listeners
> >>
> >> On 16/08/2010 18:32, CRANFORD, CHRIS wrote:
> >>>
> >>> I recently upgraded my Tomcat installation from 6.0.x to Tomcat 7
> >>> (Win64) and I am actively testing our current web applications for
> >>> backward compatibility, and so forth.  One of these web
> applications
> >>> creates a set of context listeners to manage various things during
> >> the
> >>> lifecycle of the web application.
> >>>
> >>> During the startup of the web app, I do see that the
> >>> contextInitialized() method is called; however when either Tomcat
> is
> >>> stopped or restarted whether from the command line or via
MyEclipse
> >> 8.6;
> >>> I do not see that contextDestroyed() is being invoked.  This is
> >> causing
> >>> some heartburn on our end with this particular web app and I
cannot
> >> find
> >>> any solution.
> >>>
> >>> Has anyone seen this and/or is this confirmed as a problem with
> >> Tomcat
> >>> 7?
> >>> Or is there another expectation under Servlet 3.0 that I may have
> >>> overlooked.
> >>
> >> Which exact version of Tomcat 7.0?
> >>
> >> Are you able to consistently reproduce this?
> >>
> >> What means are you using to determine that contextDestroyed() is
not
> >> called?  Log messages or... ?
> >>
> >>
> >> p
> >>
> >>> Chris
> >>>
> >>>
> >>>
> >
---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>
> >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >



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


Re: Destroying Context Listeners

Posted by Pid <pi...@pidster.com>.
On 17/08/2010 14:11, CRANFORD, CHRIS wrote:
> When I check the version of Tomcat 7, it says it is 7.0.0.0.
> It's the compiled version from 6/13/2010.

Try downloading the latest beta, (or compile from trunk).

 http://people.apache.org/~markt/dev/tomcat-7/v7.0.2/bin/

> And yes, the log calls in the destroy method are never done, hence my

It might seem like a silly question, but it's not always guaranteed that
someone is using log messages to determine a fault.

Is the log call the very first statement in the method?

What kind of logging is it?  If it's a proper logging system and not a
System.out.println call, can you try with the latter instead?


p


> concern that it isn't being invoked.  Under Tomcat 6, these log messages
> were captured and written indicating a successful execution of the
> method.  Even when I use a simple context listener that does a log
> message at startup and destroy times, only the startup one is captured.
> 
> Chris 
> 
>> -----Original Message-----
>> From: Pid [mailto:pid@pidster.com]
>> Sent: Tuesday, August 17, 2010 7:47 AM
>> To: Tomcat Users List
>> Subject: Re: Destroying Context Listeners
>>
>> On 16/08/2010 18:32, CRANFORD, CHRIS wrote:
>>>
>>> I recently upgraded my Tomcat installation from 6.0.x to Tomcat 7
>>> (Win64) and I am actively testing our current web applications for
>>> backward compatibility, and so forth.  One of these web applications
>>> creates a set of context listeners to manage various things during
>> the
>>> lifecycle of the web application.
>>>
>>> During the startup of the web app, I do see that the
>>> contextInitialized() method is called; however when either Tomcat is
>>> stopped or restarted whether from the command line or via MyEclipse
>> 8.6;
>>> I do not see that contextDestroyed() is being invoked.  This is
>> causing
>>> some heartburn on our end with this particular web app and I cannot
>> find
>>> any solution.
>>>
>>> Has anyone seen this and/or is this confirmed as a problem with
>> Tomcat
>>> 7?
>>> Or is there another expectation under Servlet 3.0 that I may have
>>> overlooked.
>>
>> Which exact version of Tomcat 7.0?
>>
>> Are you able to consistently reproduce this?
>>
>> What means are you using to determine that contextDestroyed() is not
>> called?  Log messages or... ?
>>
>>
>> p
>>
>>> Chris
>>>
>>>
>>>
> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


RE: Destroying Context Listeners

Posted by "CRANFORD, CHRIS" <Ch...@setech.com>.
When I check the version of Tomcat 7, it says it is 7.0.0.0.
It's the compiled version from 6/13/2010.

And yes, the log calls in the destroy method are never done, hence my
concern that it isn't being invoked.  Under Tomcat 6, these log messages
were captured and written indicating a successful execution of the
method.  Even when I use a simple context listener that does a log
message at startup and destroy times, only the startup one is captured.

Chris 

> -----Original Message-----
> From: Pid [mailto:pid@pidster.com]
> Sent: Tuesday, August 17, 2010 7:47 AM
> To: Tomcat Users List
> Subject: Re: Destroying Context Listeners
> 
> On 16/08/2010 18:32, CRANFORD, CHRIS wrote:
> >
> > I recently upgraded my Tomcat installation from 6.0.x to Tomcat 7
> > (Win64) and I am actively testing our current web applications for
> > backward compatibility, and so forth.  One of these web applications
> > creates a set of context listeners to manage various things during
> the
> > lifecycle of the web application.
> >
> > During the startup of the web app, I do see that the
> > contextInitialized() method is called; however when either Tomcat is
> > stopped or restarted whether from the command line or via MyEclipse
> 8.6;
> > I do not see that contextDestroyed() is being invoked.  This is
> causing
> > some heartburn on our end with this particular web app and I cannot
> find
> > any solution.
> >
> > Has anyone seen this and/or is this confirmed as a problem with
> Tomcat
> > 7?
> > Or is there another expectation under Servlet 3.0 that I may have
> > overlooked.
> 
> Which exact version of Tomcat 7.0?
> 
> Are you able to consistently reproduce this?
> 
> What means are you using to determine that contextDestroyed() is not
> called?  Log messages or... ?
> 
> 
> p
> 
> > Chris
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >



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


Re: Destroying Context Listeners

Posted by Pid <pi...@pidster.com>.
On 16/08/2010 18:32, CRANFORD, CHRIS wrote:
> 
> I recently upgraded my Tomcat installation from 6.0.x to Tomcat 7
> (Win64) and I am actively testing our current web applications for
> backward compatibility, and so forth.  One of these web applications
> creates a set of context listeners to manage various things during the
> lifecycle of the web application.
> 
> During the startup of the web app, I do see that the
> contextInitialized() method is called; however when either Tomcat is
> stopped or restarted whether from the command line or via MyEclipse 8.6;
> I do not see that contextDestroyed() is being invoked.  This is causing
> some heartburn on our end with this particular web app and I cannot find
> any solution.
> 
> Has anyone seen this and/or is this confirmed as a problem with Tomcat
> 7?
> Or is there another expectation under Servlet 3.0 that I may have
> overlooked.

Which exact version of Tomcat 7.0?

Are you able to consistently reproduce this?

What means are you using to determine that contextDestroyed() is not
called?  Log messages or... ?


p

> Chris
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>