I'm having a problem reloading a Java web application on Tomcat 5.0.3
on Windows 2000.
I'm developing a web application that needs to be deployed as an
expanded directory structure (the app contains Axis classes, which
need to write a file to the app's WEB-INF dir). I want to be be able
to change the Java classes and have Tomcat reload the updated classes
automatically.
I don't care what mechanism is used to deploy the app (war file that
Tomcat expands; directory I create by unjarring a war file, etc.) or
where the expanded directory resides, as long as the following are
true:
1. The deployment process can be done with Ant alone (no manual
intervention)
2. Any classes that were updated are reloaded automatically
3. Tomcat does not have to be restarted (although the app can be
stopped and started)
It seems that setting the app's "reloadable" context attribute would
do the trick, but I can't seem to convince Tomcat to respect the app's
reloadable setting. So far I've tried many permutations of two basic
scenarios:
SCENARIO 1:
Set server's unpackWARs attribute to true and deploy app as war file.
I tried adding a context file (rainforest.xml, below) to the app's
META-INF. I also tried copying a context file to webapps before
deploying the war file. In both cases, Tomcat either ignores or
overwrites my context file with a new context file whose reloadable
attribute is false.
SCENARIO 2:
Deployed app as expanded directory
A. Initial deployment:
1. copied rainservice.xml to webapps
2. unjarred the war file into webapps/rainservice
B. After changing service implementation
1. unjarred new war file into webapps/rainservice
Result: Application hangs - clients can't get socket connection to
app.
The Ant reload task gives errors in both cases. I tried to undeploy
and deploy the app using the Ant undeploy task but the undeploy also
gave errors in both cases (IncompatibleClassChangeError). However, I
can remove the app with the gui app manager.
autoDeploy and liveDeploy are both set to true for the Host.
Here's the context file (rainservice.xml):
<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper"
configFile="webapps\rainservice.xml"
cookies="true"
crossContext="false"
debug="0"
docBase="C:\jwsdp\webapps\rainservice"
domain="Catalina"
engineName="Catalina"
j2EEApplication="none"
j2EEServer="none"
lazy="true"
mapperClass="org.apache.catalina.core.StandardContextMapper"
path="/rainservice"
privileged="false"
reloadable="true"
startupTime="10"
swallowOutput="false"
tldScanTime="1151"
useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper"
Thanks,
Mike |