| 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.
|
 |
 |
|
|
subject: Servlet Context in cluster environment - was6
|
|
|