You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gabriele Bulfon <gb...@sonicle.com> on 2011/12/12 18:46:47 UTC

Deployment over a running webapp does not call session detroyed?

Hi,
don't know if this is a problem of Tomcat integrated into NetBeans, but I noticed that rebuilding
my webapp (causing netbeans redeployment over the running webapp), older threads spawn by
running sessions are not killed, getting into exceptions because the real HttpSession objects
are killed and the jndi connections are closed.
I have a SessionListener in my webapp that kills this threads and cleanly exit the session, but
this is never called when redeployed.
On the other hand, the ContextListener contextDestroyed is called, but I have no way to
access my threads and kill them from there....
Is this a bug or am I missing something?
Gabriele.

RE: Deployment over a running webapp does not call session detroyed?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Gabriele Bulfon [mailto:gbulfon@sonicle.com] 
> Subject: RE: Deployment over a running webapp does not call session detroyed?

> what is the point to mantain http sessions valid when all the 
> other stuff have been destroyed and reloaded?

Sounds like your webapp doesn't reinitialize itself properly, but is simply assuming the existence of objects based on session existence - an invalid assumption.  Again, you should be using context listeners for that, not session ones.

> If there is any design I should follow to recreate my new object
> structure on the mantained sessions, I would try to do it.

Yes - a ServletContextListener (or perhaps a HttpSessionActivationListener).  If you simply want to prevent session persistence, configure your <Context> to not do so:

http://tomcat.apache.org/tomcat-7.0-doc/config/manager.html#Persistence_Across_Restarts

 - 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.


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


RE: Deployment over a running webapp does not call session detroyed?

Posted by Gabriele Bulfon <gb...@sonicle.com>.
I was really hoping that the bug was mine, but...in my case, mantaining sessions during deployment
is totally useless, because my server classes instances have changed, probably destroyed by Tomcat,
and most of them are obviously per session instances. Also, Tomcat seems to destroy jndi data sources
during deployment, thus invalidating any previously taken data source.
As my webapp is secured through JAAS, I also notice that reloading the webapp after deployment,
brings me back to the configured login page, as if the security context is no more valid.
So, my question is, what is the point to mantain http sessions valid when all the other stuff have
been destroyed and reloaded?
If there is any design I should follow to recreate my new object structure on the mantained sessions,
I would try to do it.
Thanx a lot!
Gabriele.
----------------------------------------------------------------------------------
Da: Caldarale, Charles R
A: Tomcat Users List
Data: 12 dicembre 2011 19.02.26 CET
Oggetto: RE: Deployment over a running webapp does not call session detroyed?
From: Gabriele Bulfon [mailto:gbulfon@sonicle.com]
Subject: Deployment over a running webapp does not call session detroyed?
the ContextListener contextDestroyed is called, but I have no way to
access my threads and kill them from there....
Is this a bug or am I missing something?
Yes, it's a bug - yours.  By design, sessions are maintained across a webapp redeployment.  You'll need to make your code smarter about tracking auxiliary threads that you start and that Tomcat is completely unaware of.  For example, you could save the threads in some sort of list or array accessible to your context listener, and have it take care of shutting down your threads.
- 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.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org

RE: Deployment over a running webapp does not call session detroyed?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Gabriele Bulfon [mailto:gbulfon@sonicle.com] 
> Subject: Deployment over a running webapp does not call session detroyed?

> the ContextListener contextDestroyed is called, but I have no way to
> access my threads and kill them from there....

> Is this a bug or am I missing something?

Yes, it's a bug - yours.  By design, sessions are maintained across a webapp redeployment.  You'll need to make your code smarter about tracking auxiliary threads that you start and that Tomcat is completely unaware of.  For example, you could save the threads in some sort of list or array accessible to your context listener, and have it take care of shutting down your threads.

 - 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.


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