You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Aggarwal, Ajay" <Aj...@stratus.com> on 2011/04/08 19:36:49 UTC

HttpSessionActivationListener sessionDidActivate not getting called

This is strange. I did some work few months ago for my application to
manage my sessions using a combination of HttpSessionActivationListener
and HttpSessionListener (not going into the details here as to why I
needed this). When I did that work HttpSessionActivationListener was
working fine and both methods (sessionDidActivate and
sessionWillPassivate) were being called back properly when tomcat was
restarted.

 

Lately I am seeing that sessionDidActivate() does not get called upon
tomcat restart, even though sessionWillPassivate() is called. Also even
though sessionWillPassivate() is called, I don't see the session
persistence file being created (the one that I specified in
conf/context.xml <context><Manager pathname="xxx"> ).

 

I also see a bug 48717
(https://issues.apache.org/bugzilla/show_bug.cgi?id=48717) on this
issue. Not sure what's its status is w.r.t. tomcat release 6.0.x. But
the strange thing is that I am on the same version of Tomcat (6.0.20)
where I did the initial work and everything was working properly. What
could have caused this to break?

 

Looking for suggestions whether upgrading to latest 6.0.x will help or
is it something in my application that's breaking this functionality
(given that it was working before).  How can I debug this issue further?

 

-Ajay

 

 

 


RE: HttpSessionActivationListener sessionDidActivate not getting called

Posted by "Aggarwal, Ajay" <Aj...@stratus.com>.
Interestingly, after I moved the <context><Manager> configuration to the
context.xml of the application where I wanted this functionality, its
working again, however I still see multiple attempts to persist
sessions.

-----Original Message-----
From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 

did any data actually get written to

/shared/httpd/tomcat_sessions

It could be that there is a permission problem

best
Filip



On 4/8/2011 1:20 PM, Aggarwal, Ajay wrote:
> I enabled logging, created 1 session and restarted tomcat. This is
what
> I see in the logs. Is there anything suspicious here?
>
> Why are there multiple attempts to persist sessions? Is it one per
> application? One thing that has changed is now I have multiple
> applications. And the path "/shared/httpd/tomcat_sessions" for
> persistence is configured in {TOMCAT_BASE}/conf/context.xml, which
means
> it applies to all apps. So perhaps my 1st app is persisting the
session
> ok. But 2nd app that has no sessions is overriding the session
> persistence file.
>
> I will try by moving this configuration to the application where I
> really need this functionality.
>
> Meanwhile can anybody, familiar with this code, validate my theory?
>
> --- while stopping----
> DEBUG [main] 2011-04-08 15:05:37,352
> org.apache.catalina.session.ManagerBase - Stopping
> DEBUG [main] 2011-04-08 15:05:37,352
> org.apache.catalina.session.ManagerBase - Unloading persisted sessions
> DEBUG [main] 2011-04-08 15:05:37,352
> org.apache.catalina.session.ManagerBase - Saving persisted sessions to
> /shared/httpd/tomcat_sessions
> DEBUG [main] 2011-04-08 15:05:37,353
> org.apache.catalina.session.ManagerBase - Unloading 1 sessions
> DEBUG [main] 2011-04-08 15:05:37,359
> org.apache.catalina.session.ManagerBase - Expiring 1 persisted
sessions
> DEBUG [main] 2011-04-08 15:05:37,359
> org.apache.catalina.session.ManagerBase - Unloading complete
> DEBUG [main] 2011-04-08 15:05:37,590
> org.apache.catalina.session.ManagerBase - Stopping
> DEBUG [main] 2011-04-08 15:05:37,590
> org.apache.catalina.session.ManagerBase - Unloading persisted sessions
> DEBUG [main] 2011-04-08 15:05:37,590
> org.apache.catalina.session.ManagerBase - Saving persisted sessions to
> /shared/httpd/tomcat_sessions
> DEBUG [main] 2011-04-08 15:05:37,590
> org.apache.catalina.session.ManagerBase - Unloading 0 sessions
> DEBUG [main] 2011-04-08 15:05:37,590
> org.apache.catalina.session.ManagerBase - Expiring 0 persisted
sessions
> DEBUG [main] 2011-04-08 15:05:37,590
> org.apache.catalina.session.ManagerBase - Unloading complete
> DEBUG [main] 2011-04-08 15:05:37,597
> org.apache.catalina.session.ManagerBase - Stopping
>
> --- restarting ----
> DEBUG [main] 2011-04-08 15:05:40,463
> org.apache.catalina.session.ManagerBase - Start: Loading persisted
> sessions
> DEBUG [main] 2011-04-08 15:05:40,464
> org.apache.catalina.session.ManagerBase - Loading persisted sessions
> from /shared/httpd/tomcat_sessions
> DEBUG [main] 2011-04-08 15:05:40,464
> org.apache.catalina.session.ManagerBase - Creating custom object input
> stream for class loader
> DEBUG [main] 2011-04-08 15:05:40,470
> org.apache.catalina.session.ManagerBase - Loading 0 persisted sessions
>
> -----Original Message-----
> From: Aggarwal, Ajay [mailto:Ajay.Aggarwal@stratus.com]
>
> That's the first thing I thought too. However I don't see anything in
> the logs to indicate this. Also when sessionWillPassivate() is called
I
> am logging all session attributes to make sure there is nothing non
> serializable there.
>
>
> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
>
>> From: Aggarwal, Ajay [mailto:Ajay.Aggarwal@stratus.com]
>> Subject: HttpSessionActivationListener sessionDidActivate not getting
> called
>
>> Lately I am seeing that sessionDidActivate() does not get called upon
>> tomcat restart, even though sessionWillPassivate() is called. Also
> even
>> though sessionWillPassivate() is called, I don't see the session
>> persistence file being created (the one that I specified in
>> conf/context.xml<context><Manager pathname="xxx">  ).
> Perhaps you are now storing something in the session that is not
> serializable.  I would expect some log entries indicating such if
that's
> the case.
>
>   - Chuck
>
>


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


Re: HttpSessionActivationListener sessionDidActivate not getting called

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
did any data actually get written to

/shared/httpd/tomcat_sessions

It could be that there is a permission problem

best
Filip



On 4/8/2011 1:20 PM, Aggarwal, Ajay wrote:
> I enabled logging, created 1 session and restarted tomcat. This is what
> I see in the logs. Is there anything suspicious here?
>
> Why are there multiple attempts to persist sessions? Is it one per
> application? One thing that has changed is now I have multiple
> applications. And the path "/shared/httpd/tomcat_sessions" for
> persistence is configured in {TOMCAT_BASE}/conf/context.xml, which means
> it applies to all apps. So perhaps my 1st app is persisting the session
> ok. But 2nd app that has no sessions is overriding the session
> persistence file.
>
> I will try by moving this configuration to the application where I
> really need this functionality.
>
> Meanwhile can anybody, familiar with this code, validate my theory?
>
> --- while stopping----
> DEBUG [main] 2011-04-08 15:05:37,352
> org.apache.catalina.session.ManagerBase - Stopping
> DEBUG [main] 2011-04-08 15:05:37,352
> org.apache.catalina.session.ManagerBase - Unloading persisted sessions
> DEBUG [main] 2011-04-08 15:05:37,352
> org.apache.catalina.session.ManagerBase - Saving persisted sessions to
> /shared/httpd/tomcat_sessions
> DEBUG [main] 2011-04-08 15:05:37,353
> org.apache.catalina.session.ManagerBase - Unloading 1 sessions
> DEBUG [main] 2011-04-08 15:05:37,359
> org.apache.catalina.session.ManagerBase - Expiring 1 persisted sessions
> DEBUG [main] 2011-04-08 15:05:37,359
> org.apache.catalina.session.ManagerBase - Unloading complete
> DEBUG [main] 2011-04-08 15:05:37,590
> org.apache.catalina.session.ManagerBase - Stopping
> DEBUG [main] 2011-04-08 15:05:37,590
> org.apache.catalina.session.ManagerBase - Unloading persisted sessions
> DEBUG [main] 2011-04-08 15:05:37,590
> org.apache.catalina.session.ManagerBase - Saving persisted sessions to
> /shared/httpd/tomcat_sessions
> DEBUG [main] 2011-04-08 15:05:37,590
> org.apache.catalina.session.ManagerBase - Unloading 0 sessions
> DEBUG [main] 2011-04-08 15:05:37,590
> org.apache.catalina.session.ManagerBase - Expiring 0 persisted sessions
> DEBUG [main] 2011-04-08 15:05:37,590
> org.apache.catalina.session.ManagerBase - Unloading complete
> DEBUG [main] 2011-04-08 15:05:37,597
> org.apache.catalina.session.ManagerBase - Stopping
>
> --- restarting ----
> DEBUG [main] 2011-04-08 15:05:40,463
> org.apache.catalina.session.ManagerBase - Start: Loading persisted
> sessions
> DEBUG [main] 2011-04-08 15:05:40,464
> org.apache.catalina.session.ManagerBase - Loading persisted sessions
> from /shared/httpd/tomcat_sessions
> DEBUG [main] 2011-04-08 15:05:40,464
> org.apache.catalina.session.ManagerBase - Creating custom object input
> stream for class loader
> DEBUG [main] 2011-04-08 15:05:40,470
> org.apache.catalina.session.ManagerBase - Loading 0 persisted sessions
>
> -----Original Message-----
> From: Aggarwal, Ajay [mailto:Ajay.Aggarwal@stratus.com]
>
> That's the first thing I thought too. However I don't see anything in
> the logs to indicate this. Also when sessionWillPassivate() is called I
> am logging all session attributes to make sure there is nothing non
> serializable there.
>
>
> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
>
>> From: Aggarwal, Ajay [mailto:Ajay.Aggarwal@stratus.com]
>> Subject: HttpSessionActivationListener sessionDidActivate not getting
> called
>
>> Lately I am seeing that sessionDidActivate() does not get called upon
>> tomcat restart, even though sessionWillPassivate() is called. Also
> even
>> though sessionWillPassivate() is called, I don't see the session
>> persistence file being created (the one that I specified in
>> conf/context.xml<context><Manager pathname="xxx">  ).
> Perhaps you are now storing something in the session that is not
> serializable.  I would expect some log entries indicating such if that's
> the case.
>
>   - Chuck
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1209 / Virus Database: 1500/3559 - Release Date: 04/08/11
>
>
>


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


RE: HttpSessionActivationListener sessionDidActivate not getting called

Posted by "Aggarwal, Ajay" <Aj...@stratus.com>.
I enabled logging, created 1 session and restarted tomcat. This is what
I see in the logs. Is there anything suspicious here? 

Why are there multiple attempts to persist sessions? Is it one per
application? One thing that has changed is now I have multiple
applications. And the path "/shared/httpd/tomcat_sessions" for
persistence is configured in {TOMCAT_BASE}/conf/context.xml, which means
it applies to all apps. So perhaps my 1st app is persisting the session
ok. But 2nd app that has no sessions is overriding the session
persistence file.

I will try by moving this configuration to the application where I
really need this functionality. 

Meanwhile can anybody, familiar with this code, validate my theory?

--- while stopping----
DEBUG [main] 2011-04-08 15:05:37,352
org.apache.catalina.session.ManagerBase - Stopping
DEBUG [main] 2011-04-08 15:05:37,352
org.apache.catalina.session.ManagerBase - Unloading persisted sessions
DEBUG [main] 2011-04-08 15:05:37,352
org.apache.catalina.session.ManagerBase - Saving persisted sessions to
/shared/httpd/tomcat_sessions
DEBUG [main] 2011-04-08 15:05:37,353
org.apache.catalina.session.ManagerBase - Unloading 1 sessions
DEBUG [main] 2011-04-08 15:05:37,359
org.apache.catalina.session.ManagerBase - Expiring 1 persisted sessions
DEBUG [main] 2011-04-08 15:05:37,359
org.apache.catalina.session.ManagerBase - Unloading complete
DEBUG [main] 2011-04-08 15:05:37,590
org.apache.catalina.session.ManagerBase - Stopping
DEBUG [main] 2011-04-08 15:05:37,590
org.apache.catalina.session.ManagerBase - Unloading persisted sessions
DEBUG [main] 2011-04-08 15:05:37,590
org.apache.catalina.session.ManagerBase - Saving persisted sessions to
/shared/httpd/tomcat_sessions
DEBUG [main] 2011-04-08 15:05:37,590
org.apache.catalina.session.ManagerBase - Unloading 0 sessions
DEBUG [main] 2011-04-08 15:05:37,590
org.apache.catalina.session.ManagerBase - Expiring 0 persisted sessions
DEBUG [main] 2011-04-08 15:05:37,590
org.apache.catalina.session.ManagerBase - Unloading complete
DEBUG [main] 2011-04-08 15:05:37,597
org.apache.catalina.session.ManagerBase - Stopping

--- restarting ----
DEBUG [main] 2011-04-08 15:05:40,463
org.apache.catalina.session.ManagerBase - Start: Loading persisted
sessions
DEBUG [main] 2011-04-08 15:05:40,464
org.apache.catalina.session.ManagerBase - Loading persisted sessions
from /shared/httpd/tomcat_sessions
DEBUG [main] 2011-04-08 15:05:40,464
org.apache.catalina.session.ManagerBase - Creating custom object input
stream for class loader
DEBUG [main] 2011-04-08 15:05:40,470
org.apache.catalina.session.ManagerBase - Loading 0 persisted sessions

-----Original Message-----
From: Aggarwal, Ajay [mailto:Ajay.Aggarwal@stratus.com] 

That's the first thing I thought too. However I don't see anything in
the logs to indicate this. Also when sessionWillPassivate() is called I
am logging all session attributes to make sure there is nothing non
serializable there.


-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 

> From: Aggarwal, Ajay [mailto:Ajay.Aggarwal@stratus.com] 
> Subject: HttpSessionActivationListener sessionDidActivate not getting
called

> Lately I am seeing that sessionDidActivate() does not get called upon
> tomcat restart, even though sessionWillPassivate() is called. Also
even
> though sessionWillPassivate() is called, I don't see the session
> persistence file being created (the one that I specified in
> conf/context.xml <context><Manager pathname="xxx"> ).

Perhaps you are now storing something in the session that is not
serializable.  I would expect some log entries indicating such if that's
the case.

 - Chuck


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


RE: HttpSessionActivationListener sessionDidActivate not getting called

Posted by "Aggarwal, Ajay" <Aj...@stratus.com>.
That's the first thing I thought too. However I don't see anything in
the logs to indicate this. Also when sessionWillPassivate() is called I
am logging all session attributes to make sure there is nothing non
serializable there.


-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: Friday, April 08, 2011 2:05 PM
To: Tomcat Users List
Subject: RE: HttpSessionActivationListener sessionDidActivate not
getting called

> From: Aggarwal, Ajay [mailto:Ajay.Aggarwal@stratus.com] 
> Subject: HttpSessionActivationListener sessionDidActivate not getting
called

> Lately I am seeing that sessionDidActivate() does not get called upon
> tomcat restart, even though sessionWillPassivate() is called. Also
even
> though sessionWillPassivate() is called, I don't see the session
> persistence file being created (the one that I specified in
> conf/context.xml <context><Manager pathname="xxx"> ).

Perhaps you are now storing something in the session that is not
serializable.  I would expect some log entries indicating such if that's
the case.

 - 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


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


RE: HttpSessionActivationListener sessionDidActivate not getting called

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Aggarwal, Ajay [mailto:Ajay.Aggarwal@stratus.com] 
> Subject: HttpSessionActivationListener sessionDidActivate not getting called

> Lately I am seeing that sessionDidActivate() does not get called upon
> tomcat restart, even though sessionWillPassivate() is called. Also even
> though sessionWillPassivate() is called, I don't see the session
> persistence file being created (the one that I specified in
> conf/context.xml <context><Manager pathname="xxx"> ).

Perhaps you are now storing something in the session that is not serializable.  I would expect some log entries indicating such if that's the case.

 - 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