You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mojoRising <jp...@averoinc.com> on 2008/04/10 18:30:13 UTC
Does Struts 2 support clustering?
We have struts running great on a single server but when we test in our
clustered environment there are problems: The user is not staying on the
same server the initial request came in on, so their session is getting
lost. Does struts 2 support a clustered enterprise environment? If so, is
there anything special that needs to be done to make this work? Our
environment is Apache,weblogic9.2, struts2.
Thanks!
--John
--
View this message in context: http://www.nabble.com/Does-Struts-2-support-clustering--tp16609897p16609897.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Does Struts 2 support clustering?
Posted by Ian Roughley <ia...@fdar.com>.
How are you clustering the HTTP session? Usually this involves
configuration of the app server so that it is stored in some type of
non-transient storage.
/Ian
mojoRising wrote:
> We have struts running great on a single server but when we test in our
> clustered environment there are problems: The user is not staying on the
> same server the initial request came in on, so their session is getting
> lost. Does struts 2 support a clustered enterprise environment? If so, is
> there anything special that needs to be done to make this work? Our
> environment is Apache,weblogic9.2, struts2.
>
> Thanks!
> --John
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Does Struts 2 support clustering?
Posted by Guillaume Bilodeau <gb...@yahoo.com>.
The injected sessionMap is sufficient if all you need to do is get, set and
remove session attributes. For other things like invalidating the session,
you should implement ServletRequestAware and retrieve the session using the
injected HttpServletRequest.
As you can see from the source code, the sessionMap doesn't give you access
to the request.
The serialVersionUID has nothing to do with the session ID, it's for
standard Java serialization[1].
Cheers,
GB
[1] http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html
http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html
Thank you very much. I found the source code and looked at it and now I
understand perfectly. I can't believe I missed all that info the SessionMap
object. So then once you have a sessionMap I assume that that the
sessionMap is the only thing you need for accessing the request, clearing
the session, and invalidating the session, right? Also, is the
serialVersionUID in fact the same thing as the sessionId?
Guillaume Bilodeau wrote:
>
> I suggest you have a look at the source code for the
> org.apache.struts2.dispatcher.SessionMap, this is what gets injected to
> your SessionAware action. As you'll see it's simply a class that
> implements the java.util.Map interface and wraps a HttpSession. Calls to
> the get, put and remove methods all impact the underlying session object.
> It's not a separate HashMap.
>
> Cheers,
> GB
>
>
--
View this message in context: http://www.nabble.com/Does-Struts-2-support-clustering--tp16609897p16628206.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Does Struts 2 support clustering?
Posted by mojoRising <jp...@averoinc.com>.
Thank you very much. I found the source code and looked at it and now I
understand perfectly. I can't believe I missed all that info the SessionMap
object. So then once you have a sessionMap I assume that that the
sessionMap is the only thing you need for accessing the request, clearing
the session, and invalidating the session, right? Also, is the
serialVersionUID in fact the same thing as the sessionId?
Guillaume Bilodeau wrote:
>
> I suggest you have a look at the source code for the
> org.apache.struts2.dispatcher.SessionMap, this is what gets injected to
> your SessionAware action. As you'll see it's simply a class that
> implements the java.util.Map interface and wraps a HttpSession. Calls to
> the get, put and remove methods all impact the underlying session object.
> It's not a separate HashMap.
>
> Cheers,
> GB
>
>
--
View this message in context: http://www.nabble.com/Does-Struts-2-support-clustering--tp16609897p16628197.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Does Struts 2 support clustering?
Posted by Guillaume Bilodeau <gb...@yahoo.com>.
I suggest you have a look at the source code for the
org.apache.struts2.dispatcher.SessionMap, this is what gets injected to your
SessionAware action. As you'll see it's simply a class that implements the
java.util.Map interface and wraps a HttpSession. Calls to the get, put and
remove methods all impact the underlying session object. It's not a
separate HashMap.
Cheers,
GB
mojoRising wrote:
>
> Thank you all for your help. I think we have it resolved and it was indeed
> the WLCookieName parameter (JSESSIONID) in the weblogic plugin that was
> set incorrectly. This has led to heavy discussion however with regards to
> this question:
> Is it really a good idea to implement the SessionAware interface and use a
> separate Hashmap to hold the user's session data? Would it not be perhaps
> safer and more efficient (and reduce the possibility of clustered session
> replication issues) to simply get the session yourself and set the
> attributes directly into it? What benefit is there to making struts the
> middleman and using a separate Hashmap? We are having this debate
> currently at my co. and I am lacking a convincing reason to avoid dealing
> directly with the session. THanks!
>
>
>
--
View this message in context: http://www.nabble.com/Does-Struts-2-support-clustering--tp16609897p16628146.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Does Struts 2 support clustering?
Posted by Brad A Cupit <br...@lsu.edu>.
>> Would it not be perhaps safer and more efficient (and reduce the
>> possibility of clustered session replication issues) to simply
>> get the session yourself and set the
>> attributes directly into it?
the Map passed in when you implement SessionAware is just a wrapper
around the real session. So any changes that you make to the Map are
immediately written out to the real session, so there shouldn't be any
problem with session replication. Though I must confess, I don't know
what you mean that the problem was with the JSESSIONID parameter.
>> What benefit is there to making struts the
>> middleman and using a separate Hashmap?
This decouples your action from the underlying servlets, while minimally
coupling you to Struts. As a result, your action is only tied to the
Map. This makes testing easier: just pass in a normal HashMap to the
setSession() method rather than a mock HttpSession. By decoupling like
this, your code is more of a POJO and less of a Struts-specific Action
(and certainly less tied to the Servlet spec), thus enabling the logic
to be used elsewhere, perhaps in a different project, or in the same
project but after moving to an alternative front-end framework.
Brad Cupit
Louisiana State University - UIS
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Does Struts 2 support clustering?
Posted by mojoRising <jp...@averoinc.com>.
Thank you all for your help. I think we have it resolved and it was indeed
the WLCookieName parameter (JSESSIONID) in the weblogic plugin that was set
incorrectly. This has led to heavy discussion however with regards to this
question:
Is it really a good idea to implement the SessionAware interface and use a
separate Hashmap to hold the user's session data? Would it not be perhaps
safer and more efficient (and reduce the possibility of clustered session
replication issues) to simply get the session yourself and set the
attributes directly into it? What benefit is there to making struts the
middleman and using a separate Hashmap? We are having this debate currently
at my co. and I am lacking a convincing reason to avoid dealing directly
with the session. THanks!
You can configure sticky sessions, which means that requests that go to one
server in your cluster will always go to that server. To me this defeats the
purpose of the cluster because if that machine goes down the user will be
sent to another server, but their session will be gone with the down server.
However this is the best performing configuration. Another option is shared
sessions and this is covered in the WebLogic documentation at
http://edocs.bea.com. How or if the session is shared in a cluster has
nothing to do with Struts or any web application really.
Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications
--
View this message in context: http://www.nabble.com/Does-Struts-2-support-clustering--tp16609897p16627886.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Does Struts 2 support clustering?
Posted by Randy Burgess <RB...@nuvox.com>.
You can configure sticky sessions, which means that requests that go to one
server in your cluster will always go to that server. To me this defeats the
purpose of the cluster because if that machine goes down the user will be
sent to another server, but their session will be gone with the down server.
However this is the best performing configuration. Another option is shared
sessions and this is covered in the WebLogic documentation at
http://edocs.bea.com. How or if the session is shared in a cluster has
nothing to do with Struts or any web application really.
Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications
> From: mojoRising <jp...@averoinc.com>
> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> Date: Thu, 10 Apr 2008 13:45:11 -0700 (PDT)
> To: <us...@struts.apache.org>
> Subject: Re: Does Struts 2 support clustering?
>
>
> Thanks. That is what I suspect also but I am trying to weed out other
> possibilities... can I then take your response to mean : "Yes, Struts 2 DOES
> support clustering"?
>
>
>
> newton.dave wrote:
>>
>>
>> This is almost certainly a server configuration issue; in general nothing
>> on
>> the framework / application side should have anything to do with session
>> management or even be aware of it.
>>
>> Dave
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Does-Struts-2-support-clustering--tp16609897p16617641.ht
> ml
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
This email and any attachments ("Message") may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Does Struts 2 support clustering?
Posted by mojoRising <jp...@averoinc.com>.
Thanks. That is what I suspect also but I am trying to weed out other
possibilities... can I then take your response to mean : "Yes, Struts 2 DOES
support clustering"?
newton.dave wrote:
>
>
> This is almost certainly a server configuration issue; in general nothing
> on
> the framework / application side should have anything to do with session
> management or even be aware of it.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
View this message in context: http://www.nabble.com/Does-Struts-2-support-clustering--tp16609897p16617641.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Does Struts 2 support clustering?
Posted by Dave Newton <ne...@yahoo.com>.
--- mojoRising <jp...@averoinc.com> wrote:
> We have struts running great on a single server but when we test in our
> clustered environment there are problems: The user is not staying on the
> same server the initial request came in on, so their session is getting
> lost. Does struts 2 support a clustered enterprise environment? If so, is
> there anything special that needs to be done to make this work? Our
> environment is Apache,weblogic9.2, struts2.
This is almost certainly a server configuration issue; in general nothing on
the framework / application side should have anything to do with session
management or even be aware of it.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org