ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzatz_5.4.0.1/51/trb/trbhttpsessprobs.htm

133 lines
11 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
<title>Troubleshoot: HTTP sessions</title>
</head>
<BODY>
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h3><a name="trbhttpsessprobs"></a>Troubleshoot: HTTP sessions</h3>
<p><strong>Note:</strong> To view and update the Session Manager settings discussed here, use the administrative console. Select the application server that hosts the problem application, then under <strong>Additional properties</strong>, select <strong>Web Container</strong>, then <strong>Session manager</strong>.</p>
<p>What kind of problem are you having?</p>
<ul>
<li><a href="#created">HTTP Sessions are not getting created, or are lost between requests</a>.</li>
<li><a href="#persistent">HTTP Sessions are not persistent (session data lost when application server restarts, or not shared across cluster)</a>.</li>
<li><a href="#shared">Session is shared across multiple browsers on same client machine</a>.</li>
<li><a href="#invalidated">Session is not getting invalidated immediately after specified Session timeout interval</a>.</li>
<li><a href="#jsps">Unwanted sessions are being created by JSP files</a>.</li>
<li><a href="#data">Session data intended for one client is seen by another client</a>.</li>
</ul>
<p><strong><a name="created"></a>HTTP Sessions are not getting created, or are lost between requests</strong></p>
<p>By default, the Session Manager uses cookies to store the session ID on the client between requests. Unless you intend to avoid cookie-based session tracking, ensure that cookies are flowing between WebSphere Application Server - Express and the browser:</p>
<ul>
<li>Make sure the <strong>Enable cookies</strong> checkbox is checked under the <strong>Session tracking Mechanism</strong> property.</li>
<li>Make sure cookies are enabled on the browser you are testing from or from which your users are accessing the application.</li>
<li>Check the Cookie domain specified on the SessionManager (to view the or update the cookie settings, in the <strong>Session tracking mechanism->enable cookies</strong> property, click <strong>Modify</strong>).
<ul></li>
<li>For example, if the cookie domain is set as <em>&quot;.myCom.com&quot;</em>, resources should be accessed using that domain name, e.g. http://www.myCom.com/myapp/servlet/sessionservlet.</li>
<li>If the domain property is set, make sure it begins with a dot (.). Certain versions of Netscape do not accept cookies if domain name doesn't start with a dot. Microsoft Internet Explorer honors the domain with or without a dot. For example, if the domain name is set to <em>mycom.com</em>, change it to <em>.mycom.com</em> so that both Netscape and Internet Explorer honor the cookie.</li>
</ul>
<li>Check the <strong>Cookie path</strong> specified on the SessionManager. Check whether the problem URL is hierarchically below the Cookie path specified. If not correct the Cookie path.</li>
<li>If the <tt>Cookie maximum age</tt> property is set, ensure that the client (browser) machine's date and time is the same as the server's, including the time zone. If the client and the server time difference is over the &quot;Cookie maximum age&quot; then every access would be a new session, since the cookie will &quot;expire&quot; after the access.</li>
<li>If you have multiple web modules within an enterprise application that track sessions:
<ul></li>
<li>If you want to have different session settings among web modules in an enterprise application, ensure that each web module specifies a different cookie name or path.</li>
<li>If Web modules within an enterprise application use a common cookie name and path, ensure that the HTTP session settings, such as Cookie maximum age, are the same for all Web modules. Otherwise cookie behavior will be unpredictable, and will depend upon which application creates the session. Note that this does not affect session data, which is maintained separately by Web module.</li>
</ul>
<li>Check the cookie flow between browser and server:
<ol></li>
<li>On the browser, enable &quot;cookie prompt&quot;. Hit the servlet and make sure cookie is being prompted.</li>
<li>On the server, enable SessionManager trace. Enable tracing for the HTTP Session Manager component, by using the trace specification &quot;com.ibm.ws.webcontainer.httpsession.*=all=enabled&quot;. After trace is enabled, exercise your session-using servlet or JSP file, then follow the instructions for dumping and browsing the trace output. See <a href="trbenabletrace.htm">Enable the trace service</a> for more information.</li>
<li>Access the session servlet from the browser.</li>
<li>The browser will prompt for the cookie; note the jsessionid.</li>
<li>Reload the servlet, note down the cookie if a new cookie is sent.</li>
<li>Check the session trace and look for the session id and trace the request by the thread. Verify that the session is stable across web requests:
<ul></li>
<li>Look for <strong>getIHttpsession(...)</strong>, which is start of session request.</li>
<li>Look for <strong>releaseSesson(..)</strong>, which is end of servlet request.</li>
</ul>
</ol>
<li>If you are using URL rewriting instead of cookies:
<ul></li>
<li>Ensure there are no static HTML pages on your application's navigation path.</li>
<li>Ensure that your servlets and JSP files are implementing URL rewriting correctly. For details and an example see <a href="../program/sesdeci.htm">Deciding between session tracking approaches</a> in the <em>Application Development</em> topic.</li>
</ul>
<li>If you are using SSL as your session tracking mechanism:
<ul></li>
<li>Ensure that you have SSL enabled on your IBM HTTP Server or iPlanet HTTP server.</li>
<li>Review <a href="../program/sesdeci.htm">Deciding between session tracking approaches</a> in the <em>Application Development</em> topic.</li>
</ul>
</ul>
<p><strong><a name="persistent"></a>HTTP Sessions are not persistent </strong></p>
<p>If your HTTP sessions are not persistent, that is session data is lost when the application server restarts or is not shared across the cluster:</p>
<ul>
<li>Check the Datasource.</li>
<li>Check the SessionManager's Persistence Settings properties:
<ul></li>
<li>If you intend to take advantage of Session Persistence, verify that Persistence is set to <strong>Database</strong> or <strong>Memory to Memory Replication</strong>.</li>
<li>If you are using <strong>Database-based persistence</strong>:
<ul></li>
<li>Check the JNDI name of the datasource specified correctly on SessionManager.</li>
<li>Specify correct userid and password for accessing the database.
<p>Note that these settings have to be checked against the properties of an existing Data Source in the administrative console. The Session Manager does not automatically create a session database for you.</p></li>
<li>The Datasource should be non-JTA (non XA enabled).</li>
<li>Check the <a href="trbjvmintro.htm">Java Virtual Machine log file</a> for appropriate database error messages.</li>
<li>With DB2, for row sizes other than 4K, make sure specified row size matches the DB2 page size. Make sure tablespace name is specified correctly.</li>
</ul>
</ul>
</ul>
<p><strong><a name="shared"></a>Session is shared across multiple browsers on same client machine</strong></p>
<p>This behavior is browser-dependent. It varies between browser vendors, and also may change according to whether a browser is launched as a new process or as a subprocess of an existing browser session.</p>
<p>The Cookie maximum age property of the Session Manager also affects this behavior, if cookies are used as the session-tracking mechanism. If the maximum age is set to some positive value, all browser instances share the cookies, which are persisted to file on the client for the specified maximum age time.</p>
<p><strong><a name="invalidated"></a>Session is not getting invalidated immediately after specified Session timeout interval</strong></p>
<p>The Session Manager invalidation process thread runs every x seconds to invalidate any invalid sessions, where x is determined based on the Session timeout interval specified in the Session manager properties. For the default value of 30 minutes, x is around 300 seconds. In this case, it could take up to 5 minutes (300 seconds) beyond the timeout threshold of 30 minutes for a particular session to become invalidated.</p>
<p><strong><a name="jsps"></a>Unwanted sessions are being created by JSP files</strong></p>
<p>As required by the JavaServer Page specification, by default, JSP files perform a request.getSession(true), so that a session is created if none exists for the client. To prevent JSP files from creating a new session, set the session scope to false in the JSP file using the page directive as follows:</p>
<pre>&lt;% @page session=&quot;false&quot; %&gt;</pre>
<p><strong><a name="data"></a>Session data intended for one client is seen by another client</strong></p>
<p>In rare situations, usually due to application errors, session data intended for one client might be seen by another client. This situation is referred to as session data crossover. When the DebugSessionCrossover custom property is set to true, code is enabled to detect and log instances of session data crossover. Checks are performed to verify that only the session associated with the request is accessed or referenced. Messages are logged if any discrepancies are detected. These messages provide a starting point for debugging this problem. This additional checking is only performed when running on the WebSphere-managed dispatch thread, not on any user-created threads. See <a href="../admin/help/uweb_custom_settings.html">Web container custom properties</a> <img src="help.gif" width="18" height="15" alt="Go to Help documentation"> for more information.</p>
<p>Additionally, use the following resources for more troubleshooting assistance:</p>
<ul>
<li><p>Read the release notes.
<a href="http://www.ibm.com/servers/eserver/iseries/software/websphere/wsappserver/express/docs/relnotesexp51.html" target="_">WebSphere Application Server - Express Release Notes</a> (http://www.ibm.com/servers/eserver/iseries/software/websphere/wsappserver/express/docs/
relnotesexp51.html) <img src="www.gif" width="18" height="15" alt="Link outside Information Center" border="0">.</p></li>
<li><p>Check the <a href="http://www.ibm.com/servers/eserver/iseries/software/websphere/wsappserver/docs/faq.htm"
target="_">WebSphere Application Server FAQ database</a> <img src="www.gif" width="18" height="15" alt="Link outside Information Center" border="0">.</p></li>
<li><p>Refer to the <a href="http://www.ibm.com/eserver/iseries/software/websphere/wsappserver/services/forum.htm"
target="_">WebSphere Application Server for iSeries newsgroup</a> <a href="http://www.ibm.com/eserver/iseries/software/websphere/wsappserver/services/forum.htm"
target="_"><img src="www.gif" width="18" height="15" alt="Link outside Information Center" border="0"></a>.
<br>
This iSeries Technical Support Web-based forum is dedicated to WebSphere
Application Server for iSeries.</p></li>
<li><p>Contact IBM support. For more information, see <a href="../intro/support.htm">Get support for WebSphere Application Server - Express</a> in the <em>Overview</em> topic.</p></li>
</ul>
</body>
</html>