tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Running two versions of servlet in same tomcat instance
Date Mon, 19 Sep 2011 19:51:00 GMT
Hash: SHA1


On 9/18/2011 1:37 PM, Tod Olson wrote:
> I would like to run two versions of the same servlet (same 
> servlet-class, but with different WAR filename, servlet-name and 
> url-pattern) under a single instance of Tomcat 6.0.33.

Your nomenclature is wrong. From what you are saying, you want to
deploy the same webapp twice in the same container.

> Basically, the aim is to run both test and production versions of
> the servlet under the same instance.

Uh, I would highly recommend against that for two obvious reasons:
security and performance. Having said that...

> Better to run them under separate instances, but getting a
> suitable second instance is proving difficult.

Get an EC2 instance. They're cheap.

> I thought that the same servlet-class would be fine as long as the 
> servlet-name and url-pattern were different, but does not seem to
> be enough.

Don't try to mess around with web.xml: do this through webapp deployment.

Glad to see you got it working with Andre's help.

I would caution you about using nested context paths (i.e. /foo for a
production servlet URL and /test/foo for test) because you will get
overlapping JSESSIONID cookie paths (one for '/' and one for '/test').
This can cause all kinds of confusion, even if you are the only one
doing it (presumably customers aren't using 'test' on a regular basis).

There's another reason to deploy production to, say, '/prod': it will
force you to ensure that all your links are prefixed and encoded
properly. If you have one URL that is not properly prefixed, then
users of '/test' will suddenly end up in the production environment
(possibly unauthenticated) and confusion will ensue.

Hope that helps,
- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message