tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From inamin...@pobox.com
Subject Re: JSessionID problem
Date Fri, 07 Nov 2003 09:35:14 GMT
Quoting Thyago Lisboa Mota <thyago@tre-ce.gov.br>:

> Hi, 
> 
>     I am facing a problem with jsessionid and I hope u guys can help me.  I
> have 2 tomcat (4.1.29 version) configurations, one at W2K (for develop) and
> another at Linux Red Hat (for production).  The W2K one is working just fine.
>  But with the Linux one I always receive the same ID for the jsessionid, no
> matter how many times I refresh the page.  Bellow is the JSP scriptlet I am
> using for test purpose (file "Session.jsp" saved at webapps\ROOT ): 
> 
> <%
>  out.println("Session ID: " + session);
>  out.println("<BR>Date: " + session.getAttribute("date"));
>  session.setAttribute("date", new java.util.Date());
>  out.println("<br><a href=\"" + response.encodeURL("session.jsp") + "\">Click
> here</a>");
> %>

Provided you have this declared in your JSP:

<%@ page language="java" import="java.util.Date, java.util.Enumeration" %>

You might try to get session info with the following scriptlet:

<%

	// print session info

        Date created = new Date(session.getCreationTime());
        Date accessed = new Date(session.getLastAccessedTime());
        out.print("ID: " + session.getId() + "<br />");
        out.print("Created: " + created + "<br />");
        out.print("Last Accessed: " + accessed + "<br />");
        out.print("<br />Attribute names : <br />");

        Enumeration e = session.getAttributeNames();
	while (e.hasMoreElements()) {
	    out.print(e.nextElement() + "<br />");
	}
	%>

> 
>   If I test this code from the Linux Tomcat Server (just typing
> http://myserver/session.jsp ) jsessionid doesn´t change each time a refresh
> the page... 
Isn't it the way it should work ? Keeping a single session between requests ? 
But I only have RedHat Linux, for dev. and prod. ;)

>And the link doesnt show jsessionid either, as should (notice the
> "encodeURL")
> 
>   The configuration files (server.xml) of Tomcats are the same in both
> plattaforms. The only difference is the attribute appbase of the host element
> ("/var/www/webapps" at Linux). 
> 
>   Any clues ? 
> 
> Thyago
> 
> My server.xml: 
> 
> <Server
>  port="8005"
>  shutdown="SHUTDOWN"
>    debug="0">
> 
>  <Service name="Tomcat-Standalone">
> 
>  <Connector
>       className="org.apache.coyote.tomcat4.CoyoteConnector"
>    port="8080"
>        minProcessors="5"
>        maxProcessors="75"
>        enableLookups="true"
>        redirectPort="8443"
>        acceptCount="100"
>        debug="0"
>        connectionTimeout="20000"
>        useURIValidationHack="false"
>        disableUploadTimeout="true" />
> 
>      <Engine
>        name="Standalone"
>          defaultHost="localhost"
>          debug="0">
> 
>    <Host
>         name="localhost"
>             debug="0"
>             appBase="d:\webapps" 
>          unpackWARs="false"
>             autoDeploy="true">
> 
>     <Context
>            path=""
>                docBase="raiz"
>                debug="0"
>                reloadable="true"
>                crossContext="true" />
> 
>        </Host>
>     </Engine>
>  </Service>
> </Server>
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message