You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chase Yarbrough <ve...@gmail.com> on 2007/07/30 02:45:36 UTC

sessions not persisting between servlet calls

Hello,

My sessions are not persisting between servlet calls within the same
webapp!  I set a session in one servlet call, and get it in another within
the same webapp, and it creates a new session, with a different session ID.

I think the problem might have something to do with the path of the session
cookie?  The path of the cookie is /webappname and the host is
www.servername.org.  however, the path of my webapp is /webappnameservlets
and the host is www.servername.org:8081.  I'm using apache's <proxypass> and
<proxypassreverse> directives to send requests at /webappname on port 80 to
/webappnameservlets on port 8081.  is this why my sessions are being
dropped, and if so, how can i fix this?

I'm using tomcat 6.0.13, Java 1.6.0, and Centos 4.

Thanks,
Chase Yarbrough

Re: sessions not persisting between servlet calls

Posted by Chase Yarbrough <ve...@gmail.com>.
Hey All,

Thanks for all your help.  I've fixed it!  For future reference, the problem
was similar to what was described.  The path in the cookie was different
because I proxied /webappnameservlets to /webappname.  When I changed the
proxy so that the directory names matched, the sessions started working!

Chase Yarbrough

On 7/29/07, Filip Hanik - Dev Lists <de...@hanik.com> wrote:
>
> David Smith wrote:
> > If you are proxying your webapp, did you also set proxyName and
> > proxyPort in your connector config for port 8081 in server.xml?
> in httpd.conf use ProxyPreserveHost, and that way you only have to set
> proxyPort in server.xml
> but even without proxyPort/proxyName, your cookies should have worked
>
> Filip
>
> >
> > See http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
> >
> > --David
> >
> > Chase Yarbrough wrote:
> >> Hello,
> >>
> >> My sessions are not persisting between servlet calls within the same
> >> webapp!  I set a session in one servlet call, and get it in another
> >> within
> >> the same webapp, and it creates a new session, with a different
> >> session ID.
> >>
> >> I think the problem might have something to do with the path of the
> >> session
> >> cookie?  The path of the cookie is /webappname and the host is
> >> www.servername.org.  however, the path of my webapp is
> >> /webappnameservlets
> >> and the host is www.servername.org:8081.  I'm using apache's
> >> <proxypass> and
> >> <proxypassreverse> directives to send requests at /webappname on port
> >> 80 to
> >> /webappnameservlets on port 8081.  is this why my sessions are being
> >> dropped, and if so, how can i fix this?
> >>
> >> I'm using tomcat 6.0.13, Java 1.6.0, and Centos 4.
> >>
> >> Thanks,
> >> Chase Yarbrough
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: sessions not persisting between servlet calls

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
David Smith wrote:
> If you are proxying your webapp, did you also set proxyName and 
> proxyPort in your connector config for port 8081 in server.xml?
in httpd.conf use ProxyPreserveHost, and that way you only have to set 
proxyPort in server.xml
but even without proxyPort/proxyName, your cookies should have worked

Filip

>
> See http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
>
> --David
>
> Chase Yarbrough wrote:
>> Hello,
>>
>> My sessions are not persisting between servlet calls within the same
>> webapp!  I set a session in one servlet call, and get it in another 
>> within
>> the same webapp, and it creates a new session, with a different 
>> session ID.
>>
>> I think the problem might have something to do with the path of the 
>> session
>> cookie?  The path of the cookie is /webappname and the host is
>> www.servername.org.  however, the path of my webapp is 
>> /webappnameservlets
>> and the host is www.servername.org:8081.  I'm using apache's 
>> <proxypass> and
>> <proxypassreverse> directives to send requests at /webappname on port 
>> 80 to
>> /webappnameservlets on port 8081.  is this why my sessions are being
>> dropped, and if so, how can i fix this?
>>
>> I'm using tomcat 6.0.13, Java 1.6.0, and Centos 4.
>>
>> Thanks,
>> Chase Yarbrough
>>
>>   
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: sessions not persisting between servlet calls

Posted by David Smith <dn...@cornell.edu>.
If you are proxying your webapp, did you also set proxyName and 
proxyPort in your connector config for port 8081 in server.xml?

See http://tomcat.apache.org/tomcat-6.0-doc/config/http.html

--David

Chase Yarbrough wrote:
> Hello,
>
> My sessions are not persisting between servlet calls within the same
> webapp!  I set a session in one servlet call, and get it in another within
> the same webapp, and it creates a new session, with a different session ID.
>
> I think the problem might have something to do with the path of the session
> cookie?  The path of the cookie is /webappname and the host is
> www.servername.org.  however, the path of my webapp is /webappnameservlets
> and the host is www.servername.org:8081.  I'm using apache's <proxypass> and
> <proxypassreverse> directives to send requests at /webappname on port 80 to
> /webappnameservlets on port 8081.  is this why my sessions are being
> dropped, and if so, how can i fix this?
>
> I'm using tomcat 6.0.13, Java 1.6.0, and Centos 4.
>
> Thanks,
> Chase Yarbrough
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org