|
| Problem | Customer is using HTTP Sessions and has persistent sessions enabled. In a WebSphere® Application Server configuration using only one Application Server, the application works correctly . However, once the Application Server is cloned, the application does not work properly and the customer complains that data from the HTTP Session is missing | | Cause | When enabling persistent sessions in a clustered environment (Application Servers are cloned), there are a few requirements that need to be met. If ALL of these requirements are not met, it could result in an "apparent" loss of session data. | | Solution | Requirements for persisting sessions in a clustered environment:- Any attribute (object) placed into the HTTPSession must be Serializable
If the object is not serializable, the object will not be persisted to the database and will only remain in the cache for the Java™ Virtual Machine (JVM™) that serviced the request. Therefore, if the next request goes to a different JVM, the changes that were made to that particular object will not be available.
- putValue() or setAttribute must be called after modifying an attribute of the session object
If the customer does a getValue/getAttribute for a particular object in the HttpSession and then makes a change to that object, the customer must do a putValue/setAttribute for the data to be in the session object to be updated.
If a putValue/setAttribute is not done after making a change, it will appear that “data is lost from the session object.” The following example would exemplify this behavior:- Request goes to clone1. SessionObject.getAttribute(“name”) is called. The value for "name” was returned as “Bill”.
- During this request the “name” is changed from “Bill” to “Mike” but setAttribute was not called after doing so. The value of "name" in the cache is still "Bill". The value of "name" in the database is also "Bill".
- From the same client, a second request is made and it is routed to clone2.
- SessionObject.getAttribute(“name”) is called and the session object is retrieved from the database. The value for “name” was returned as “Bill” and not “Mike”.
- Session affinity must be enabled and functioning properly
It is important that session affinity be enabled and functioning properly when persistent sessions are enabled in a clustered environment. By default, session affinity is enabled in all versions of WebSphere Application Server.
| |
| | |
| |
|
Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, Sessions and Session Management Operating system(s): Multi-Platform Software version: 3.5, 4.0, 5.0, 5.1 Software edition: Advanced Reference #: 1066838 IBM Group: Software Group Modified date: 2004-12-01
(C) Copyright IBM Corporation 2000, 2004. All Rights Reserved.
|