You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by rohit aman <ro...@gmail.com> on 2008/11/25 02:27:45 UTC

tomcat 6.0.18 clustering.. session getting replicated partially

Hi,

   I had setup a tomcat cluster with two nodes. followed the instructions
from "tomcat 6 clustering how to" document. I created a sample
application to test out my cluster.  This application has a cart where u can
add items.

now, the problem is, not all session variables are getting replicated. below
is the scenario..

1)start tomcat 1
2)access the cart add items to it ( lets say added 5 items )
3)start tomcat 2
4)add some more items ( 3 more...so totally 8) ( this is done using tomcat 1
again because my LB is configured for sticky sessions)
5)stop tomcat 1
6)access the cart (now the request goes to tomcat 2)...here *I can only see
the first 5 items where as it should be 8. *So, the next three did not get
replicated.

whichever session or session attribute gets created when both nodes are
running is not getting replicated for some reason.

I am monitoring both nodes with Jconsole. In Jconsole the number of session
for the application =  sessions in node 1 + sessions in node 2. So, this
says that sessions are being replicated. But, I am not sure why I am not
able to access all sessions/sessionAttributes.

Any help is very much appreciated.

Thanks
Rohit

Re: tomcat 6.0.18 clustering.. session getting replicated partially

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
after modifying the cart, you must add

session.setAttribute("cart",cart) to trigger replication

Filip


rohit aman wrote:
> Hey Filip,
>
>     sorry abt that. here is the example web application zip file:
> http://www.yousendit.com/download/TTZuRFFhbEo5eFh2Wmc9PQ
>
> please unzip it, put it in your webapps directory, then you should be able
> to access the cart using
> https://<hostname>/clusterex/sessions/carts.jsp<https://%3chostname%3e/clusterex/sessions/carts.jsp>
>
>
> juss FYI...this is how u can reproduce it
> 1) set the LB for sticky sessions
> 2) start tomcat1
> 3) access the cart and add some items (lets say 6 items)
> 4) now start tomcat2
> 5) add some more items ( lets say 3 more...so total items would be 6+3=9)
> (here request still goes to tomcat 1 because of sticky sessions setup)
> 6) stop tomcat1
> 7) add some more items (now request goes to tomcat2, here we can see that
> the new item gets added as 7th item to the first 6 items and the 3 items we
> added later can not be seen)
>
> Thanks for the help
> rohit
>
> On Tue, Nov 25, 2008 at 10:20 AM, Filip Hanik - Dev Lists <
> devlists@hanik.com> wrote:
>
>   
>> you're attachment didn't go through, just post a complete example somewhere
>> on the web.
>> for free support, you can't expect the other guy (me in this case) to have
>> to spend time setting up to replicate your environment
>> instead, you do the legwork, and you get help for free, not a bad trade if
>> you ask me
>> Filip
>>
>> rohit aman wrote:
>>
>>     
>>> Hi Filip,
>>>     All I did was to modify sessions application that comes with tomcat.
>>> It's just two simple changes shown below.
>>>
>>>   1) Replace the DummCart.class in
>>> <tomcat-home>\apache-tomcat-6.0.18\webapps\examples\WEB-INF\classes\sessions
>>> with the attached one.
>>>   2)mark the web.xml in
>>> <tomcat-home>\apache-tomcat-6.0.18\webapps\examples\WEB-INF as distributable
>>> by adding </distributable> tag
>>>   3)then access this by using
>>> https://localhost/examples/jsp/sessions/carts.jsp
>>>
>>> Please let me know...Thanks for doing this
>>> Rohit
>>>
>>>  On Mon, Nov 24, 2008 at 6:55 PM, Filip Hanik - Dev Lists <
>>> devlists@hanik.com <ma...@hanik.com>> wrote:
>>>
>>>    post a sample app, and we can test it out
>>>
>>>    Filip
>>>
>>>
>>>    rohit aman wrote:
>>>
>>>        Hi,
>>>
>>>          I had setup a tomcat cluster with two nodes. followed the
>>>        instructions
>>>        from "tomcat 6 clustering how to" document. I created a sample
>>>        application to test out my cluster.  This application has a
>>>        cart where u can
>>>        add items.
>>>
>>>        now, the problem is, not all session variables are getting
>>>        replicated. below
>>>        is the scenario..
>>>
>>>        1)start tomcat 1
>>>        2)access the cart add items to it ( lets say added 5 items )
>>>        3)start tomcat 2
>>>        4)add some more items ( 3 more...so totally 8) ( this is done
>>>        using tomcat 1
>>>        again because my LB is configured for sticky sessions)
>>>        5)stop tomcat 1
>>>        6)access the cart (now the request goes to tomcat 2)...here *I
>>>        can only see
>>>        the first 5 items where as it should be 8. *So, the next three
>>>        did not get
>>>        replicated.
>>>
>>>        whichever session or session attribute gets created when both
>>>        nodes are
>>>        running is not getting replicated for some reason.
>>>
>>>        I am monitoring both nodes with Jconsole. In Jconsole the
>>>        number of session
>>>        for the application =  sessions in node 1 + sessions in node
>>>        2. So, this
>>>        says that sessions are being replicated. But, I am not sure
>>>        why I am not
>>>        able to access all sessions/sessionAttributes.
>>>
>>>        Any help is very much appreciated.
>>>
>>>        Thanks
>>>        Rohit
>>>
>>>
>>>
>>>
>>>    ---------------------------------------------------------------------
>>>    To start a new topic, e-mail: users@tomcat.apache.org
>>>    <ma...@tomcat.apache.org>
>>>    To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>    <ma...@tomcat.apache.org>
>>>    For additional commands, e-mail: users-help@tomcat.apache.org
>>>    <ma...@tomcat.apache.org>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>>
>>>       
>> ---------------------------------------------------------------------
>> 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
>>
>>
>>     
>
>   


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


Re: tomcat 6.0.18 clustering.. session getting replicated partially

Posted by rohit aman <ro...@gmail.com>.
Hey Filip,

    sorry abt that. here is the example web application zip file:
http://www.yousendit.com/download/TTZuRFFhbEo5eFh2Wmc9PQ

please unzip it, put it in your webapps directory, then you should be able
to access the cart using
https://<hostname>/clusterex/sessions/carts.jsp<https://%3chostname%3e/clusterex/sessions/carts.jsp>


juss FYI...this is how u can reproduce it
1) set the LB for sticky sessions
2) start tomcat1
3) access the cart and add some items (lets say 6 items)
4) now start tomcat2
5) add some more items ( lets say 3 more...so total items would be 6+3=9)
(here request still goes to tomcat 1 because of sticky sessions setup)
6) stop tomcat1
7) add some more items (now request goes to tomcat2, here we can see that
the new item gets added as 7th item to the first 6 items and the 3 items we
added later can not be seen)

Thanks for the help
rohit

On Tue, Nov 25, 2008 at 10:20 AM, Filip Hanik - Dev Lists <
devlists@hanik.com> wrote:

> you're attachment didn't go through, just post a complete example somewhere
> on the web.
> for free support, you can't expect the other guy (me in this case) to have
> to spend time setting up to replicate your environment
> instead, you do the legwork, and you get help for free, not a bad trade if
> you ask me
> Filip
>
> rohit aman wrote:
>
>> Hi Filip,
>>     All I did was to modify sessions application that comes with tomcat.
>> It's just two simple changes shown below.
>>
>>   1) Replace the DummCart.class in
>> <tomcat-home>\apache-tomcat-6.0.18\webapps\examples\WEB-INF\classes\sessions
>> with the attached one.
>>   2)mark the web.xml in
>> <tomcat-home>\apache-tomcat-6.0.18\webapps\examples\WEB-INF as distributable
>> by adding </distributable> tag
>>   3)then access this by using
>> https://localhost/examples/jsp/sessions/carts.jsp
>>
>> Please let me know...Thanks for doing this
>> Rohit
>>
>>  On Mon, Nov 24, 2008 at 6:55 PM, Filip Hanik - Dev Lists <
>> devlists@hanik.com <ma...@hanik.com>> wrote:
>>
>>    post a sample app, and we can test it out
>>
>>    Filip
>>
>>
>>    rohit aman wrote:
>>
>>        Hi,
>>
>>          I had setup a tomcat cluster with two nodes. followed the
>>        instructions
>>        from "tomcat 6 clustering how to" document. I created a sample
>>        application to test out my cluster.  This application has a
>>        cart where u can
>>        add items.
>>
>>        now, the problem is, not all session variables are getting
>>        replicated. below
>>        is the scenario..
>>
>>        1)start tomcat 1
>>        2)access the cart add items to it ( lets say added 5 items )
>>        3)start tomcat 2
>>        4)add some more items ( 3 more...so totally 8) ( this is done
>>        using tomcat 1
>>        again because my LB is configured for sticky sessions)
>>        5)stop tomcat 1
>>        6)access the cart (now the request goes to tomcat 2)...here *I
>>        can only see
>>        the first 5 items where as it should be 8. *So, the next three
>>        did not get
>>        replicated.
>>
>>        whichever session or session attribute gets created when both
>>        nodes are
>>        running is not getting replicated for some reason.
>>
>>        I am monitoring both nodes with Jconsole. In Jconsole the
>>        number of session
>>        for the application =  sessions in node 1 + sessions in node
>>        2. So, this
>>        says that sessions are being replicated. But, I am not sure
>>        why I am not
>>        able to access all sessions/sessionAttributes.
>>
>>        Any help is very much appreciated.
>>
>>        Thanks
>>        Rohit
>>
>>
>>
>>
>>    ---------------------------------------------------------------------
>>    To start a new topic, e-mail: users@tomcat.apache.org
>>    <ma...@tomcat.apache.org>
>>    To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>    <ma...@tomcat.apache.org>
>>    For additional commands, e-mail: users-help@tomcat.apache.org
>>    <ma...@tomcat.apache.org>
>>
>>
>> ------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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: tomcat 6.0.18 clustering.. session getting replicated partially

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
you're attachment didn't go through, just post a complete example 
somewhere on the web.
for free support, you can't expect the other guy (me in this case) to 
have to spend time setting up to replicate your environment
instead, you do the legwork, and you get help for free, not a bad trade 
if you ask me
Filip

rohit aman wrote:
> Hi Filip,
>  
>    All I did was to modify sessions application that comes with 
> tomcat. It's just two simple changes shown below.
>
>    1) Replace the DummCart.class in 
> <tomcat-home>\apache-tomcat-6.0.18\webapps\examples\WEB-INF\classes\sessions 
> with the attached one.
>    2)mark the web.xml in 
> <tomcat-home>\apache-tomcat-6.0.18\webapps\examples\WEB-INF as 
> distributable by adding </distributable> tag
>    3)then access this by using 
> https://localhost/examples/jsp/sessions/carts.jsp
>
> Please let me know...Thanks for doing this
> Rohit
>
> On Mon, Nov 24, 2008 at 6:55 PM, Filip Hanik - Dev Lists 
> <devlists@hanik.com <ma...@hanik.com>> wrote:
>
>     post a sample app, and we can test it out
>
>     Filip
>
>
>     rohit aman wrote:
>
>         Hi,
>
>           I had setup a tomcat cluster with two nodes. followed the
>         instructions
>         from "tomcat 6 clustering how to" document. I created a sample
>         application to test out my cluster.  This application has a
>         cart where u can
>         add items.
>
>         now, the problem is, not all session variables are getting
>         replicated. below
>         is the scenario..
>
>         1)start tomcat 1
>         2)access the cart add items to it ( lets say added 5 items )
>         3)start tomcat 2
>         4)add some more items ( 3 more...so totally 8) ( this is done
>         using tomcat 1
>         again because my LB is configured for sticky sessions)
>         5)stop tomcat 1
>         6)access the cart (now the request goes to tomcat 2)...here *I
>         can only see
>         the first 5 items where as it should be 8. *So, the next three
>         did not get
>         replicated.
>
>         whichever session or session attribute gets created when both
>         nodes are
>         running is not getting replicated for some reason.
>
>         I am monitoring both nodes with Jconsole. In Jconsole the
>         number of session
>         for the application =  sessions in node 1 + sessions in node
>         2. So, this
>         says that sessions are being replicated. But, I am not sure
>         why I am not
>         able to access all sessions/sessionAttributes.
>
>         Any help is very much appreciated.
>
>         Thanks
>         Rohit
>
>          
>
>
>
>     ---------------------------------------------------------------------
>     To start a new topic, e-mail: users@tomcat.apache.org
>     <ma...@tomcat.apache.org>
>     To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>     <ma...@tomcat.apache.org>
>     For additional commands, e-mail: users-help@tomcat.apache.org
>     <ma...@tomcat.apache.org>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
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: tomcat 6.0.18 clustering.. session getting replicated partially

Posted by rohit aman <ro...@gmail.com>.
Hi Filip,

   All I did was to modify sessions application that comes with tomcat. It's
just two simple changes shown below.

   1) Replace the DummCart.class in
<tomcat-home>\apache-tomcat-6.0.18\webapps\examples\WEB-INF\classes\sessions
with the attached one.
   2)mark the web.xml in
<tomcat-home>\apache-tomcat-6.0.18\webapps\examples\WEB-INF as distributable
by adding </distributable> tag
   3)then access this by using
https://localhost/examples/jsp/sessions/carts.jsp

Please let me know...Thanks for doing this
Rohit

On Mon, Nov 24, 2008 at 6:55 PM, Filip Hanik - Dev Lists <devlists@hanik.com
> wrote:

> post a sample app, and we can test it out
>
> Filip
>
>
> rohit aman wrote:
>
>> Hi,
>>
>>   I had setup a tomcat cluster with two nodes. followed the instructions
>> from "tomcat 6 clustering how to" document. I created a sample
>> application to test out my cluster.  This application has a cart where u
>> can
>> add items.
>>
>> now, the problem is, not all session variables are getting replicated.
>> below
>> is the scenario..
>>
>> 1)start tomcat 1
>> 2)access the cart add items to it ( lets say added 5 items )
>> 3)start tomcat 2
>> 4)add some more items ( 3 more...so totally 8) ( this is done using tomcat
>> 1
>> again because my LB is configured for sticky sessions)
>> 5)stop tomcat 1
>> 6)access the cart (now the request goes to tomcat 2)...here *I can only
>> see
>> the first 5 items where as it should be 8. *So, the next three did not get
>> replicated.
>>
>> whichever session or session attribute gets created when both nodes are
>> running is not getting replicated for some reason.
>>
>> I am monitoring both nodes with Jconsole. In Jconsole the number of
>> session
>> for the application =  sessions in node 1 + sessions in node 2. So, this
>> says that sessions are being replicated. But, I am not sure why I am not
>> able to access all sessions/sessionAttributes.
>>
>> Any help is very much appreciated.
>>
>> Thanks
>> Rohit
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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: tomcat 6.0.18 clustering.. session getting replicated partially

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
post a sample app, and we can test it out

Filip

rohit aman wrote:
> Hi,
>
>    I had setup a tomcat cluster with two nodes. followed the instructions
> from "tomcat 6 clustering how to" document. I created a sample
> application to test out my cluster.  This application has a cart where u can
> add items.
>
> now, the problem is, not all session variables are getting replicated. below
> is the scenario..
>
> 1)start tomcat 1
> 2)access the cart add items to it ( lets say added 5 items )
> 3)start tomcat 2
> 4)add some more items ( 3 more...so totally 8) ( this is done using tomcat 1
> again because my LB is configured for sticky sessions)
> 5)stop tomcat 1
> 6)access the cart (now the request goes to tomcat 2)...here *I can only see
> the first 5 items where as it should be 8. *So, the next three did not get
> replicated.
>
> whichever session or session attribute gets created when both nodes are
> running is not getting replicated for some reason.
>
> I am monitoring both nodes with Jconsole. In Jconsole the number of session
> for the application =  sessions in node 1 + sessions in node 2. So, this
> says that sessions are being replicated. But, I am not sure why I am not
> able to access all sessions/sessionAttributes.
>
> Any help is very much appreciated.
>
> Thanks
> Rohit
>
>   


---------------------------------------------------------------------
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: tomcat 6.0.18 clustering.. session getting replicated partially

Posted by rohit aman <ro...@gmail.com>.
Hi Bhoosan,

   I am using sticky session setup at LB. What do you mean by "use
replicated sessions"? I dont have that kind of configuration setup at my LB.


As far as I know, whatever the configuration at LB is, when cluster
configuration (in server.xml) is correct, session replication should be done
no matter what the LB is setup for.

Thanks
Rohit

On Mon, Nov 24, 2008 at 11:08 PM, Bhooshan Pandit <bh...@aol.com>wrote:

> Why don't you use replicated sessions? I believe with sticky sessions the
> session data does not get copied over to other servers in the LB setup, with
> replicated session it does.
>
> -----Original Message-----
> From: rohit aman <ro...@gmail.com>
> To: Tomcat Users List <us...@tomcat.apache.org>
> Sent: Tue, 25 Nov 2008 6:57 am
> Subject: tomcat 6.0.18 clustering.. session getting replicated partially
>
>
>
>
>
>
>
>
> Hi,
>
>   I had setup a tomcat cluster with two nodes. followed the instructions
> from "tomcat 6 clustering how to" document. I created a sample
> application to test out my cluster.  This application has a cart where u
> can
> add items.
>
> now, the problem is, not all session variables are getting replicated.
> below
> is the scenario..
>
> 1)start tomcat 1
> 2)access the cart add items to it ( lets say added 5 items )
> 3)start tomcat 2
> 4)add some more items ( 3 more...so totally 8) ( this is done using tomcat
> 1
> again because my LB is configured for sticky sessions)
> 5)stop tomcat 1
> 6)access the cart (now the request goes to tomcat 2)...here *I can only see
> the first 5 items where as it should be 8. *So, the next three did not get
> replicated.
>
> whichever session or session attribute gets created when both nodes are
> running is not getting replicated for some reason.
>
> I am monitoring both nodes with Jconsole. In Jconsole the number of session
> for the application =  sessions in node 1 + sessions in node 2. So, this
> says that sessions are being replicated. But, I am not sure why I am not
> able to access all sessions/sessionAttributes.
>
> Any help is very much appreciated.
>
> Thanks
> Rohit
>
>
>
>
>
>
>
>
>
> ________________________________________________________________________
> You are invited to Get a Free AOL Email ID. - http://webmail.aol.in
>

Re: tomcat 6.0.18 clustering.. session getting replicated partially

Posted by Bhooshan Pandit <bh...@aol.com>.
Why don't you use replicated sessions? I believe with sticky sessions the session data does not get copied over to other servers in the LB setup, with replicated session it does.

-----Original Message-----
From: rohit aman <ro...@gmail.com>
To: Tomcat Users List <us...@tomcat.apache.org>
Sent: Tue, 25 Nov 2008 6:57 am
Subject: tomcat 6.0.18 clustering.. session getting replicated partially








Hi,

   I had setup a tomcat cluster with two nodes. followed the instructions
from "tomcat 6 clustering how to" document. I created a sample
application to test out my cluster.  This application has a cart where u can
add items.

now, the problem is, not all session variables are getting replicated. below
is the scenario..

1)start tomcat 1
2)access the cart add items to it ( lets say added 5 items )
3)start tomcat 2
4)add some more items ( 3 more...so totally 8) ( this is done using tomcat 1
again because my LB is configured for sticky sessions)
5)stop tomcat 1
6)access the cart (now the request goes to tomcat 2)...here *I can only see
the first 5 items where as it should be 8. *So, the next three did not get
replicated.

whichever session or session attribute gets created when both nodes are
running is not getting replicated for some reason.

I am monitoring both nodes with Jconsole. In Jconsole the number of session
for the application =  sessions in node 1 + sessions in node 2. So, this
says that sessions are being replicated. But, I am not sure why I am not
able to access all sessions/sessionAttributes.

Any help is very much appreciated.

Thanks
Rohit



 





________________________________________________________________________
You are invited to Get a Free AOL Email ID. - http://webmail.aol.in