tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Eggers <>
Subject Re: [Tomcat 7] Why can't you use automatic deployment and exploded WAR when docBase is outside appBase?
Date Mon, 06 Aug 2012 21:23:06 GMT
On 8/6/2012 1:43 PM, Miguel Almeida wrote:
> Thanks for the input regarding 2). What's the difference between using
> javax.servlet.context.tempdir  vs ?
> Also, do you know the answer to 1 - ie, why did the change occur regarding
> not exploding when the WAR is outside appBase?

Please don't top post. I just switched to using a real mail client and I 
now know why others lament so much about this.

Anyway, from the fine documentation at:


Pathname to a scratch directory to be provided by this Context for 
temporary read-write use by servlets within the associated web 
application. This directory will be made visible to servlets in the web 
application by a servlet context attribute (of type named 
javax.servlet.context.tempdir as described in the Servlet Specification. 
If not specified, a suitable directory underneath $CATALINA_BASE/work 
will be provided.

So in short, read the Servlet Specification. (This is also of type File, 
while the property is of type String.)

I suspect that if you use javax.servlet.context.tempdir, the scratch 
space will be under CATALINA_BASE/work/[Engine]/[host]/[app].

[Engine] is by default Catalina
[host] is by default localhost
[app] is your web application context name

This is different than, which is set to CATALINA_BASE/temp.

One of the nice things about using javax.servlet.context.tempdir is that 
it's deleted when you undeploy your application.

Another nice thing about javax.servlet.context.tempdir is that you get a 
location per web application, not a location per Tomcat. This means that 
various contexts can't step on each other.

One of the not so nice things about javax.servlet.context.tempdir is 
that it normally doesn't exist outside of a servlet container or web 
application server. This means that if you do unit testing, you'll have 
to define that property when you run tests with 
-Djavax.servlet.context.tempdir="somewhere-i-can-write" and open this as 
a file (see above for comments about type).

For your answer to question 1, I guess you'll have to read any 
discussion on the development mailing list. Searchable archives are 
available online. I'm just a user, and while I casually read the 
development list I don't currently don't participate.

. . . just my 2 cents.

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

View raw message