You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Serle Shuman <se...@creator.co.za> on 2000/07/14 10:47:36 UTC
[Catalina] unable to retrieve existing session
I am using catalina on my local machine for development i.e. no domain available. I have installed my session creation/retrieval servlet in a particular context on this machine. I hit the servlet from a local browser IE4 using 127.0.0.1 IP etc. My servlet never retrieves a previously created session. I have debugged the catalina code and found that:
1) the session cookie is created correctly and send out in the response
2) the browser definitely accepts the cookie (set it to prompt on cookies)
3) the subsequent request does not contain the cookie, thus a new cookie is created by my servlet.
What's wrong?
Thanks,
Serle
Re: [Catalina] unable to retrieve existing session (resolution)
Posted by Serle Shuman <se...@creator.co.za>.
Thought this post may be useful to others:
I've checked RFC2109 and Cookies should work on IP address. I also tried to do the mapping in my hosts file i.e. map http://www.localhost.com to 127.0.0.1. I finally resolved the problem by creating a virtual host for my application. From these experiments it would seem that contexts and thier path info is confusing the browser's cookie management.
Once again thanks for the help Craig :)
Serle
----- Original Message -----
From: Craig R. McClanahan
To: tomcat-dev@jakarta.apache.org
Sent: Friday, July 14, 2000 8:26 PM
Subject: Re: [Catalina] unable to retrieve existing session
Serle Shuman wrote:
I am using catalina on my local machine for development i.e. no domain available. I have installed my session creation/retrieval servlet in a particular context on this machine. I hit the servlet from a local browser IE4 using 127.0.0.1 IP etc. My servlet never retrieves a previously created session. I have debugged the catalina code and found that:1) the session cookie is created correctly and send out in the response2) the browser definitely accepts the cookie (set it to prompt on cookies)3) the subsequent request does not contain the cookie, thus a new cookie is created by my servlet. What's wrong? Thanks,Serle
What's wrong is identified in the third step -- the browser didn't return the cookie. My understanding is that cookies don't work when you use IP addresses instead of host names.
Two options come to mind:
* Define the "localhost" name in "c:\windows\hosts" so that
it can get resolved even without a network connection, by
adding a line like this:
127.0.0.1 localhost
* Use URL rewriting to maintain your sessions even in the
absence of cookies (Catalina does support this).
Craig
Re: [Catalina] unable to retrieve existing session
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Serle Shuman wrote:
> I am using catalina on my local machine for development i.e. no domain
> available. I have installed my session creation/retrieval servlet in a
> particular context on this machine. I hit the servlet from a local
> browser IE4 using 127.0.0.1 IP etc. My servlet never retrieves a
> previously created session. I have debugged the catalina code and
> found that:1) the session cookie is created correctly and send out in
> the response2) the browser definitely accepts the cookie (set it to
> prompt on cookies)3) the subsequent request does not contain the
> cookie, thus a new cookie is created by my servlet. What's wrong?
> Thanks,Serle
What's wrong is identified in the third step -- the browser didn't
return the cookie. My understanding is that cookies don't work when you
use IP addresses instead of host names.
Two options come to mind:
* Define the "localhost" name in "c:\windows\hosts" so that
it can get resolved even without a network connection, by
adding a line like this:
127.0.0.1 localhost
* Use URL rewriting to maintain your sessions even in the
absence of cookies (Catalina does support this).
Craig