Bug 27958 - WAR files not autodeployed when changed
Summary: WAR files not autodeployed when changed
Status: RESOLVED WONTFIX
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.0.19
Hardware: All other
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-25 21:22 UTC by George Lindholm
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description George Lindholm 2004-03-25 21:22:39 UTC
An applications WAR file is not redeployed automatically when the
war file is updated.

The problem is that HostConfig.checkContextLastModified() is seeing the
wrong value for what it thinks is the name of the WAR file. Instead of
seeing "myubc.war" it sees "ROOT" so the

  if (files[i].endsWith(".war")) {

test at line 843 always fails since files[0]="ROOT"


Here is the server.xml entries for the Context:

    <Engine name="myUBC" defaultHost="scandia">
      <Host name="scandia" appBase="webapps"
        unpackWARs="true" autoDeploy="true" workDir="work">
        <Context path="" docBase="/local/src/myUBC2/myubc.war" reloadable="false">


   George
Comment 1 Remy Maucherat 2004-03-25 21:26:47 UTC
This is normal. Only webapps deployed in the host appBase will be redeployed.
Basically, this is not the way deployment occurs (and BTW, you shouldn't put
your Context in server.xml).
Comment 2 George Lindholm 2004-03-25 22:09:42 UTC
The webapp is in the host appBase:

  -Dcatalina.base=/local/src/myUBC2


And why does the code think it is looking at the name of the WAR file
when it is given the name of the directotory where the WAR file was exploded to?



  George



Comment 3 Remy Maucherat 2004-03-26 11:22:02 UTC
Look: I am really sorry about the deployer's limitations, but you have to accept
them (or use a different server). The name of the war must match the webapp name.
Otherwise, use the manager webapp or Ant tasks to reload or redeploy your
application.
Comment 4 Nick Atkins 2004-05-26 00:23:22 UTC
Remy, is this a bug or a feature because the docs say this about deployment:

"Redeployment of a web application which has been deployed from a WAR when the
WAR is updated: the expanded web application is removed, and the WAR is expanded
again. This will not happen if the host is configured so that WARs are not
expanded, in which case the webapp will be simply redeployed."

(From http://jakarta.apache.org/tomcat/tomcat-5.0-doc/deployer-howto.html)

If I read above statement correctly it means changing a WAR file should result
in its expanded directory being removed from webapps and recreated in webapps.

Am I missing something?
Comment 5 Peter Rossbach 2004-05-26 04:26:57 UTC
Hello,

a reload from a war works fine for me at 5.0.24/25 release.

Your must deploy your web application at appBase from your host.
The Deployer (HostConfig class) detect than the changed war file, delete the
extracted directory and context.xml. Than the newer war Archiv was loaded
and extract your META-INF/context.xml and the directory.

It also work when you context.xml docPath point to the extacted directory, but
this is not clever. Thing about Tomcat server that configured with
Host.unpackWARS=false! 
The complete deployment work also for ROOT.war.

I tested this and it works stable.

Regards
Peter
Comment 6 George Lindholm 2004-05-26 18:56:20 UTC
Then the documentation should be updated to reflect these "restrictions".

To me, based on what I read, it made perfect sense to do:

<Context path="" docBase="../myubc.war">

but when I debug the code I see "ROOT" being compared against "myubc", and not
being equal, ...


   George