aspose file tools
The moose likes Websphere and the fly likes Servlet Context in cluster environment - was6 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Websphere
Reply Bookmark "Servlet Context in cluster environment - was6" Watch "Servlet Context in cluster environment - was6" New topic
Author

Servlet Context in cluster environment - was6

Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
Hi,
If I have 2 jvms in my cluster, will I have two servletcontext objects? If I set attribute in application scope(servlet context) and it sets in one jvm then can I get the same value from other jvm's servlet context, if it happens to go to the next jvm in my next call?
I am using websphere 6.0 server.
Please clarify. Thanks in advance.


Rizwan
SCJA, SCJP, SCWCD, SCBCD, SCDJWS.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4967

Sorry, but the ServletContext is not synchronized between JVMs. You've just discovered one of the ways J2EE applications mysteriously break down in a clustered environment.

Best to have all ServletContext objects read from the web.xml file so they are read only. Maybe even load an object with a lifecycle listener that actually reads values from a common database.

Cheers!

-Cameron McKenzie


Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
Arvind Shukla
Ranch Hand

Joined: Jun 26, 2002
Posts: 38
You should not worry about this, WebSphere plugin sitting at WebServer takes care of this by sending subsequent requests from same client to same JVM.


Arvind,<br />IBM Certified WAS admin (Test 489, Test 340, Test341)
William Janssen
Ranch Hand

Joined: Jan 02, 2007
Posts: 39
There are WebSphere extensions for this kind of synchornisation, e.g. dynacache. With dynacache you can replicate / synchronize data within a cluster.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Context in cluster environment - was6
 
Similar Threads
****ServletContext and WebApplication confusion****
why config is read only???
Problem replicating ServletContext in the clustered environment
Servlets in Cluster environment
is ThreadLocal devil in clustering environment?