You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Giancarlo Frison <fr...@nimbuzz.com> on 2007/12/12 17:29:33 UTC

Re: HttpSessionActivationListener not getting called in the Tomcat 5.5.20 clustered mode.

I had faced the same problem, in order to 'activate' a deserialized
object coming from an other VM the session object has to implement the
HttpSessionBindingListener interface, not the
*HttpSessionActivationListener* .
The valueBound method is invoked by setAttibute's HttpSession method,
inside there you would initialize and populate the transient fields.

> Hello
>
> I am using a *tomcat* *clustered* environment using two *tomcat*
> *5*.*5*.*20*
> servers *in* *the* Windows machine. I am using *the* *in*-memory
> replication for
> replicating *the* session. *In* my code, I have a session attribute that
> implements *HttpSessionActivationListener* *interface*. I expect this
> Listener to be *called* when *the* session gets replicated on *the* other
> server. I see that *the* session gets replicated but *the* Listener is
> *not*
> *getting* *called* at all. I require this listener to be *called* so
> that I
> can *initialize* some of *the* transient session attributes when *the*
> session
> is created on one *tomcat* *instance* but *the* next request goes on
> *the* other
> server.
>
> Can you please let me know why *the* *HttpSessionActivationListener*
> is *not*
> *getting* *called*? Is *there* something which I am *not* doing
> correctly?
>


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


Re: HttpSessionActivationListener not getting called in the Tomcat 5.5.20 clustered mode.

Posted by Jess Holle <je...@ptc.com>.
I believe similar changes were still necessary in 6.0.14 as well (and 
previously were needed in 5.0.30).

Jess Holle wrote:
> I sent the patch quite some time back now, so I'm not sure where it is.
>
> Being similarly lazy I'm attaching an excerpt of the patched 
> StandardSession.java (from 5.5.23) with changes embedded in it.
>
> Mark Thomas wrote:
>> Jess Holle wrote:
>>   
>>> The HttpSession activation and passivation listeners in Tomcat are
>>> /quite/ broken -- at least last time I checked.
>>>
>>> I've been in the habit of patching this part of the code.  I submitted a
>>> patch once, but I mixed in a few other things that were broken in this
>>> area and it was not accepted -- and I've not taken time to slice up my
>>> patch into many smaller ones so they can be individually rejected :-)
>>>     
>>
>> I'm being lazy - can you point me towards your patch. I've looked at this a
>> couple of times and I thought we had it working correctly. If there is
>> still work to do I will take a look.
>>
>> Mark
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>   
>


Re: HttpSessionActivationListener not getting called in the Tomcat 5.5.20 clustered mode.

Posted by Mark Thomas <ma...@apache.org>.
Mark Thomas wrote:
> There might be a problem in clustered mode. That will take longer to test
> because I know I don't have a test case ready to go.

To summarise:
Unclustered - As far as I can see, everything works as per the spec

Clustered - This is a little tricky. The spec defines what should happen if
a session is moved from one VM to another but it doesn't specify what to do
if a session is replicated on multiple nodes. This is one of those grey
areas that needs some clarification in the spec. As I can't see anything
that isn't explicitly non-compliant, I don't think there is a strong case
for any code changes here.

Mark

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


Re: HttpSessionActivationListener not getting called in the Tomcat 5.5.20 clustered mode.

Posted by Mark Thomas <ma...@apache.org>.
Mark Thomas wrote:
> Jess Holle wrote:
>> I sent the patch quite some time back now, so I'm not sure where it is.
>>
>> Being similarly lazy I'm attaching an excerpt of the patched
>> StandardSession.java (from 5.5.23) with changes embedded in it.
> 
> Thanks for that. I checked the archives and the patch was e-mailed to dev
> but I couldn't find a bugzilla entry. Chances are it just got forgotten about.
> 
> I've looked at your patch and I see what you are doing but don't understand
> why you should need to (or why it then works). The current code should do
> what the spec requires. I'll put together a test case and see if I can
> figure out what is going on.
> 
> I have a busy few days ahead so it might be the middle of next week until I
> have some results.

As luck would have it, I had an old test case lying around. I've tested the
6.0.x trunk (same code as 5.5.x) and the behaviour is as per the spec. If
an attribute implements HttpSessionActivationListener then it gets called
on session persistence and activation. My test causes this by restarting
the app.

There might be a problem in clustered mode. That will take longer to test
because I know I don't have a test case ready to go.

Mark


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


Re: HttpSessionActivationListener not getting called in the Tomcat 5.5.20 clustered mode.

Posted by Mark Thomas <ma...@apache.org>.
Jess Holle wrote:
> I sent the patch quite some time back now, so I'm not sure where it is.
> 
> Being similarly lazy I'm attaching an excerpt of the patched
> StandardSession.java (from 5.5.23) with changes embedded in it.

Thanks for that. I checked the archives and the patch was e-mailed to dev
but I couldn't find a bugzilla entry. Chances are it just got forgotten about.

I've looked at your patch and I see what you are doing but don't understand
why you should need to (or why it then works). The current code should do
what the spec requires. I'll put together a test case and see if I can
figure out what is going on.

I have a busy few days ahead so it might be the middle of next week until I
have some results.

Mark


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


Re: HttpSessionActivationListener not getting called in the Tomcat 5.5.20 clustered mode.

Posted by Jess Holle <je...@ptc.com>.
I sent the patch quite some time back now, so I'm not sure where it is.

Being similarly lazy I'm attaching an excerpt of the patched 
StandardSession.java (from 5.5.23) with changes embedded in it.

Mark Thomas wrote:
> Jess Holle wrote:
>   
>> The HttpSession activation and passivation listeners in Tomcat are
>> /quite/ broken -- at least last time I checked.
>>
>> I've been in the habit of patching this part of the code.  I submitted a
>> patch once, but I mixed in a few other things that were broken in this
>> area and it was not accepted -- and I've not taken time to slice up my
>> patch into many smaller ones so they can be individually rejected :-)
>>     
>
> I'm being lazy - can you point me towards your patch. I've looked at this a
> couple of times and I thought we had it working correctly. If there is
> still work to do I will take a look.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>   


Re: HttpSessionActivationListener not getting called in the Tomcat 5.5.20 clustered mode.

Posted by Mark Thomas <ma...@apache.org>.
Jess Holle wrote:
> The HttpSession activation and passivation listeners in Tomcat are
> /quite/ broken -- at least last time I checked.
> 
> I've been in the habit of patching this part of the code.  I submitted a
> patch once, but I mixed in a few other things that were broken in this
> area and it was not accepted -- and I've not taken time to slice up my
> patch into many smaller ones so they can be individually rejected :-)

I'm being lazy - can you point me towards your patch. I've looked at this a
couple of times and I thought we had it working correctly. If there is
still work to do I will take a look.

Mark


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


Re: HttpSessionActivationListener not getting called in the Tomcat 5.5.20 clustered mode.

Posted by Jess Holle <je...@ptc.com>.
The HttpSession activation and passivation listeners in Tomcat are 
/quite/ broken -- at least last time I checked.

I've been in the habit of patching this part of the code.  I submitted a 
patch once, but I mixed in a few other things that were broken in this 
area and it was not accepted -- and I've not taken time to slice up my 
patch into many smaller ones so they can be individually rejected :-)

[The above may sound bitter -- I'm not.  I just don't have the time to 
spoon feed patches, especially since I'm ending up patching the same 
file anyway to address persistent session handling.]

Giancarlo Frison wrote:
> I had faced the same problem, in order to 'activate' a deserialized
> object coming from an other VM the session object has to implement the
> HttpSessionBindingListener interface, not the
> *HttpSessionActivationListener* .
> The valueBound method is invoked by setAttibute's HttpSession method,
> inside there you would initialize and populate the transient fields.
>
>   
>> Hello
>>
>> I am using a *tomcat* *clustered* environment using two *tomcat*
>> *5*.*5*.*20*
>> servers *in* *the* Windows machine. I am using *the* *in*-memory
>> replication for
>> replicating *the* session. *In* my code, I have a session attribute that
>> implements *HttpSessionActivationListener* *interface*. I expect this
>> Listener to be *called* when *the* session gets replicated on *the* other
>> server. I see that *the* session gets replicated but *the* Listener is
>> *not*
>> *getting* *called* at all. I require this listener to be *called* so
>> that I
>> can *initialize* some of *the* transient session attributes when *the*
>> session
>> is created on one *tomcat* *instance* but *the* next request goes on
>> *the* other
>> server.
>>
>> Can you please let me know why *the* *HttpSessionActivationListener*
>> is *not*
>> *getting* *called*? Is *there* something which I am *not* doing
>> correctly?
>>
>>     
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>