By default tomcat will create a session cookie for the current domain.
If you are on www.example.com, your cookie will be created for www.example.com (will only work
This is apparently supported via a configuration setting in 6.0.27 and onwards:
Configuration is done by editing META-INF/context.xml
https://issues.apache.org/bugzilla/show_bug.cgi?id=48379