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
$CATALINA_BASE/conf/[engine_name]/[host_name]):

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

*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 (http://tomcat.apache.org/tomcat-7.0-doc/config/host.html), 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
http://tomcat.apache.org/tomcat-7.0-doc/config/host.html#Automatic%20Application%20Deployment:
- When using automatic deployment, the docBase defined by an XML
Context<http://tomcat.apache.org/tomcat-7.0-doc/config/context.html>file
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.


Cheers,

Miguel Almeida

Reply via email to