You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by chennai coder <ch...@gmail.com> on 2006/02/27 11:45:58 UTC

Tomcat on different ports on same machine, JSESSIONID gets over-written

Hi,

I need to run two instances of tomcat as part of two web-applications, on
the same machine binding them to different ports.
Like say http://myhostname:8080 and http://myhostname:9090

But this has some problems when accessed from the same browser instance (say
using different tabs).

Session tracking which is based on the 'JSESSIONID' cookie set for the
domain name, in this case 'myhostname' becomes the cause for the problem.
Logging into the second service, when already logged-on in the first, will
over-write the JSESSIONID and hence invalidate the first service's session.

Some not so elegant work-arounds to live with the problem...
To use different browsers to access the services.
To use different host names to access the services, one with the DNS name
and one with the IP Address.

But is there a permanent way to solve this sort of a problem ?
One permanent way is to compile tomcat again, with a changed
org.apache.catalina.Globals.SESSION_COOKIE_NAME, which I do not want to do.
Is there a better approach ?

Thanks,
R.Rajkumar

Re: Tomcat on different ports on same machine, JSESSIONID gets over-written

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
put a apache webserver (httpd) in front of your tomcats, listening on 
one port.
use mod_proxy or mod_jk to connect from apache to both your tomcats.
if you use mod_proxy and use different webapp path names, then set the 
config emptySessionPath so that Tomcat doesn't set the webapp path in he 
cookie name

Filip

chennai coder wrote:
> Hi,
>
> I need to run two instances of tomcat as part of two web-applications, on
> the same machine binding them to different ports.
> Like say http://myhostname:8080 and http://myhostname:9090
>
> But this has some problems when accessed from the same browser instance (say
> using different tabs).
>
> Session tracking which is based on the 'JSESSIONID' cookie set for the
> domain name, in this case 'myhostname' becomes the cause for the problem.
> Logging into the second service, when already logged-on in the first, will
> over-write the JSESSIONID and hence invalidate the first service's session.
>
> Some not so elegant work-arounds to live with the problem...
> To use different browsers to access the services.
> To use different host names to access the services, one with the DNS name
> and one with the IP Address.
>
> But is there a permanent way to solve this sort of a problem ?
> One permanent way is to compile tomcat again, with a changed
> org.apache.catalina.Globals.SESSION_COOKIE_NAME, which I do not want to do.
> Is there a better approach ?
>
> Thanks,
> R.Rajkumar
>
>   


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