Women in Technology

Hear us Roar



Article:
  Top Ten Tomcat Configuration Tips
Subject:   Can you define the context of an app in a .war?
Date:   2005-05-25 06:21:44
From:   Bugboy
I'm deploying an app using Plesk (a linux type control panel). The only thing it lets you do is upload .war files.


I want my app to be the root app on my domain, can I can't seem to name the file simply <nothing>.war either?


How do I add some kind of info to the .war file that will specify that the context root must be /.


PS: You're speaking to a beginner here.


Thanks

Full Threads Newest First

Showing messages 1 through 1 of 1.

  • Can you define the context of an app in a .war?
    2005-05-26 22:40:04  jason_brittain [View]

    Which deployment options work depends on how Tomcat is configured, and
    which version of Tomcat we're talking about.. Assuming 5.5, here are
    the ways it could be deployed by hand (neglecting some limiting admin
    console program):

    1) War up the webapp so it contains a META-INF/context.xml that contains
    the Context configuration for the root webapp, and copy either the
    resulting .war file or the webapp's expanded dir into the webapps/ dir.
    2) Copy the war file (or its expanded dir) into the webapps/ dir, then
    place a "ROOT.xml" Context config file into the
    $CATALINA_BASE/conf/[enginename]/[hostname]/ directory.
    3) Edit server.xml and change/add the root Context config for your
    webapp, and restart Tomcat.
    4) Use the Admin webapp to deploy the webapp to the URI you desire.
    5) Use the manager webapp to deploy the webapp to the URI you desire.
    6) If this installation of Tomcat already was running a ROOT webapp
    (most are, by default), you could replace the webapps/ROOT directory
    entirely with the expanded dir of your own webapp, although the
    expanded dir must be named "ROOT". It would only run like that if
    your webapp doesn't need any custom Context configuration other than
    being mapped to the root URI. A restart of Tomcat may be necessary
    as well.

    Also, if a ROOT webapp is already configured in server.xml, or in a
    context.xml config file, and you try one of the above methods that would
    leave the original ROOT webapp config in place, you may get into the
    situation where two webapps are configured to be the root webapp, and
    only one of them wins. So, again, it depends on how your Tomcat is
    configured in the first place.

    I hope this helps!