views:

52

answers:

1

I have a Host that doesn't automatically deploy all web apps.

  <Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="false"
        xmlValidation="false" xmlNamespaceAware="false">

But I do want the dreambear web app to automatically reload without a restart, for development purposes (hence this is on SO, not Server Fault).

Catalina/localhost/dreambear.xml:

<Context reloadable="true">
    <Parameter name="gamePageUrl" value="http://****/dreambear.html" />
</Context>

I deploy the web app by putting dreambear.war in the webapps dir. Unfortunately, it doesn't automatically get reloaded:

  • (Host:unpackWARs = false): The new version of the WAR is not detected
  • (Host:unpackWARs = true): The new version of the WAR is not unpacked
  • (Host:unpackWARs = true): If I delete the unpacked directory, the new WAR will be unpacked but not deployed.

Is there a way to achieve what I want? I don't want to enabled autoDeploy because my context xml will be deleted every time I put in a new WAR (see here).

+1  A: 

I've tried some combinations, and none of them will redeploy from the WAR file with autoDeploy set to false.

Setting reloadable to true in Context wont work, since the docs state

Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected.

I've also tried reloading from the manager web app

http://localhost:8080/manager/reload?path=/dreambear

However, this too does not take changes from the war

This can be useful when the web application context is not reloadable and you have updated classes or property files in the /WEB-INF/classes directory or when you have added or updated jar files in the /WEB-INF/lib directory.

The manager docs are more clear on this

Currently, application reloading (to pick up changes to the classes or web.xml file) is not supported when a web application is deployed directly from a WAR file. It only works when the web application is deployed from an unpacked directory. If you are using a WAR file, you should undeploy and then deploy or deploy with the update parameter the application again to pick up your changes.

JoseK
I guess I'll just resort to uploading the app as a directory instead of a war. I vaguely remember from my school days that works better in Tomcat anyway.
Bart van Heukelom