• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Determining whether Servlet Engine has called the destroy() method on servlet

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need a way to see a servlet's lifecycle in WebSphere. I can't change the servlet's code to add logging to the destroy() method in a particular servlet. But I have a hunch the servlet is getting unloaded periodically throughout the day. This servlet was written from the standpoint that is loaded once at server restart and stays up until server shutdown. I think this servlet is being unloaded in between these lifecycle states. But I need a way to prove my theory correct.

Does anyone know of a way to see servlet lifecycle status' in WebSphere?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

This servlet was written from the standpoint that is loaded once at server restart and stays up until server shutdown.


I don't have an idea on how to prove this w/o code changes, but I seem to remember that the servlet spec is quite clear on that it is up to the servlet container on when to initialize and destroy a servlet. While most do it once on web app startup/shutdown (which is reasonable), that is not guaranteed behavior. So if the servlet is written in a way like you describe, I'd call that a bug, because it is relying on undocumented behavior (which may change from container to container, and even between versions of the same container).
 
Paul Frey
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:

This servlet was written from the standpoint that is loaded once at server restart and stays up until server shutdown.


I don't have an idea on how to prove this w/o code changes, but I seem to remember that the servlet spec is quite clear on that it is up to the servlet container on when to initialize and destroy a servlet. While most do it once on web app startup/shutdown (which is reasonable), that is not guaranteed behavior. So if the servlet is written in a way like you describe, I'd call that a bug, because it is relying on undocumented behavior (which may change from container to container, and even between versions of the same container).


I agree it is a bug and not dependable behavior according the J2EE spec. But this problem is only happening in our production environment and we can't push code with logging statements out until April 2010. I was hoping to find something such as a logging setting or something in websphere that would be able to help me determine this life cycle behavior.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can certainly trace anything and every little thing that Websphere does. I've only ever used tracing under the direction of the support people at IBM, but with some patience you should be able to find out how by looking through the Information Centre.
 
She still doesn't approve of my superhero lifestyle. Or this shameless plug:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic