Chris, thanks for getting back to me!

I'm trying to override the default cookie name (JSESSIONID) for one
of my Tomcat7 instances. I put the following in
$catalina_home/conf/context.xml:

<Context sessionCookieName="MyCookie">

That will change the session cookie name for all applications deployed
on the server, and not just one web application. Is that what you wanted
?

Yes, this is what I'm after. I'm working on an enterprise application which is comprised of over 70 webapps all working together. I need to change it for everything, as they all obey a single cookie.

However, after restarting Tomcat, the setting isn't being applied;
the cookie always remains as JSESSIONID rather than MyCookie.

My environment is: tomcat 7.0.39, java 1.7.0_79, kubuntu 14.10.

Can anyone shed some light on how/where
$catalina_home/conf/context.xml is loaded? Or any ideas,
suggestions, etc are appreciated.

I would have expected what you did to work. Do you have a separate
CATALINA_BASE as well as a CATALINA_HOME? If so, the
CATALINA_BASE/conf/context.xml will *completely override* the one in
CATALINA_HOME/conf/context.xml.

I don't believe so, output from ./shutdown.sh:

Using CATALINA_BASE:   /opt/apache-tomcat-7.0.39
Using CATALINA_OWL:   /opt/apache-tomcat-7.0.39
Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.39/temp
Using JRE_HOME:        /usr/lib/jvm/java-7-openjdk-amd64
Using CLASSPATH: /opt/apache-tomcat-7.0.39/bin/bootstrap.jar:/opt/apache-tomcat-7.0.39/bin/tomcat-juli.jar


It would probably be better to set the configuration in your web
application's META-INF/context.xml file. Give that a try and see if it
gives you the desired effect.

The problem with doing this, is that as the application is open source, modifying each subtool's context.xml would fork me from the community.

The only reason I'm trying to accomplish this, is because I have two versions of the application running in two different Tomcats; one is the community version, one is my institution's localized/modifyied version. I need to be able to run both simultaneously for comparison purposes.

However, because both Tomcats/applications are using the same JSESSIONID as the cookie name, if I start a session on one Tomcat, it invalidates the session on the other.

Anything else you can think of? Do you perhaps know how/where Tomcat is loading up the $catalina_home/conf/context.xml file? If that is known, I can perhaps modify (hack) it to point explicitly to the context.xml file that I have the sessionCookieName set.

Thanks again,

Brian

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

Reply via email to