tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miguel Almeida <>
Subject [Tomcat 7] Why can't you use automatic deployment and exploded WAR when docBase is outside appBase?
Date Mon, 06 Aug 2012 19:26:15 GMT
Dear all,

I am going to divide my question in 2. The first part concerns a change in
Tomcat7's behaviour (vs Tomcat6) that I would like to understand. The 2nd
question is what lead me to the question, and it's a practical Java issue -
where help is also appreciated.

Onwards to the questions.

Consider the following context file jamesbond.xml in

<Context docBase="/srv/apps/jamesbond.war" unpackWAR="true"
         debug="0" privileged="true">
        <Environment name="my.env" value="VAL" type="java.lang.String"

*1)* In Tomcat 6 you'd update the war at /srv/apps and it would
automatically be redeployed and exploded.

However, in Tomcat 7 this isn't happening.
>From the docs (, a
new important text that wasn't in 6 reads:
unpackWARs - (...) WAR files located outside of the Host's *appBase* will
not be expanded.

And in
- When using automatic deployment, the docBase defined by an XML
should be outside of the
appBase directory. If this is not the case, difficulties may be experienced
deploying the web application or the application may be deployed twice. The
deployIgnore attribute can be used to avoid this situation.

Both these rules means you can't have automatic deployment of files outside
appBase and explode them (into appBase).

Why is this? How can one have the same behaviour as in Tomcat 6: have the
war* outisde appBase*, use a context xml like the one above and have the
application exploded.

*2) *The motivation for this is a simple code
ServletContext.getRealPath("/") to create a simple temporary inputstream
that works in Tomcat6 but doesn't in Tomcat7 (because getRealPath("/") will
return null). Setting up a dedicated directory seems a bit of a hassle for
a temporary inputstream.


Miguel Almeida

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message