Anis Kasmani wrote:
> Hi All,
>
> Just a though. Does the Java session object faces the same problem as an ASP
> Session object in a webfarm situation. Is it advisable to use the session
> object for a WebFarm scenario.
>
> I am not sure wheter the Session class provided with the servlet engine can
> work over a webfarm where the request might be served by different App
> Servers machines.
>
> Any suggestion/pointers would be appreciated. Thanx in advance
>
The servlet 2.2 specification includes the following requirements:
* If you declare your application to be distributable in the web
application deployment descriptor (web.xml) file by using the
<distributable> element, the app server may run a copy of your
app in multiple different JVMs. If you do *not* declare your app
to be distributable, this is not allowed.
* In a distributable app, all session attributes your app stores in the
session must implement java.io.Serializable.
* In a distributable app, requests that are not part of a session can
be served by any copy of the app. However, if your request is part
of a session, all requests that are part of that session *at a particular
point in time* must be served from the same JVM.
The effect of these rules is that, in most circumstances, you don't need to
worry a
lot about the fact that your app is being used in a "web farm" environment. If
the
app server supports session migration, for example, it can only do so *between*
requests. The hardest part (from the developer's viewpoint) is ensuring that
all
your session attributes are Serializable.
NOTE: some app servers impose an additional requirement (not based on the
specs)
that servlet context attributes (i.e. application scope beans in JSP
terminology)
must also be Serializable in a distributed app scenario.
>
> Anis
>
Craig McClanahan
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets