Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
Tips on Tomcat - moving applications around

If you want to replace the root application on your Tomcat server, you can replace the ROOT folder in webapps. But there's alternatives that might be better for you.

a) Place the .war file and / or application in webapps, and replace the ROOT folder with a symbolic link to the application:
  cd /usr/local/tomcat/webapps
  cp {wherever/whatever} myrootapp.war
  mkdir myrootapp
  cd myrootapp
  jar xf ../myrootapp.war

With the last three lines only being needed if you've turned autodeploy off (a stonking good idea on a production machine!). Note that I've moved the original ROOT application - that's just in case I want to get back to it later ... then
  cd ..
  ln -s myrootapp ROOT

b) A varient on (a). On a production server, you won't want your web applications to live within /usr/local/tomcat (or equivalent); that's for tomcat itself and the configurations - vital software, but rarely changing. You'll want your webapps instead in a directory / disc area that's backed up much more often (because it's going to change more) and is available to the people who look after the application rather than the people who look after the running of the server.
  mkdir /var/www/webapps
  cp {wherever/whatever} /var/www/webapps/myrootapp.war
  cd /var/www/webapps
  mkdir myrootapp
  cd myrootapp
  jar xf ../myrootapp.war
  cd /usr/local/tomcat/webapps
  ln -s /var/www/webapps/myrootapp ROOT

c) If you wish to move all of your applications served by Tomcat to a separate area, you can change the appBase attribute of the Host element in your server.xml configuration file. Carrying on using the data we have above:
  <Host name="localhost" appBase="/var/www/webapps" ...
  <Host name="localhost" appBase="webapps" ...
and indeed you can set up symbolic links within that directory to reroot root application requests from ROOT to some other application.

Note that option (b) - with a symbolic link from one directory to another - means that the web application will only be visible via ROOT and not via its own name, whereas with options (a) and (c) it is visible both ways.

The above are just examples of what you might do; you'll also want to consider the effect of the choice you make on the autodeployer and on the Tomcat Manager application if you're running it.

Want to know more? We run Apache http and Apache Tomcat training course - see [here].
(written 2013-02-05, updated 2013-02-07)

Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
A653 - Web Application Deployment - Tomcat - Configuring Web Applications
  [3044] Changing a Servlet - more that just editing and compiling - (2010-11-12)
  [2088] Changing the 404 - file not found - page in Tomcat - (2009-03-18)
  [1909] javax.servlet cannot be resolved - how to solve - (2008-11-26)
  [1564] Default file (MiMe types) for Apache httpd and Apache Tomcat - (2008-03-04)
  [1552] Extra public classes in deploying Apache httpd and Tomcat - (2008-02-24)
  [1192] What are WEB-INF and META-INF directories? - (2007-05-18)
  [1082] Straight from the .jar - (2007-02-16)
  [1074] Java beans and classes, .war and .jar files - (2007-02-10)
  [1006] Apache httpd and Apache Tomcat together tips - (2006-12-24)
  [754] tar, jar, war, ear, sar files - (2006-06-10)
  [479] New servlet from old - (2005-10-28)
  [465] Changing Tomcat's web.xml and reloading a web application - (2005-10-15)

Back to
Onward from Brussels
Previous and next
Horse's mouth home
Forward to
Servlet v JSP (Java Server Page). What is the difference?
Some other Articles
9 years, and 4000 articles on
Handling failures / absences of your backend server nicely
Travelogue - from the Netherlands to London via Hook and Harwich
Servlet v JSP (Java Server Page). What is the difference?
Tips on Tomcat - moving applications around
Onward from Brussels
On board Eurostar - a running commentary
Two trains a day ... how many fares to London? Guess!
Conference and Meeting Rooms available in Melksham
Email from Christopher Columbus to announce finding America?
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page

This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2019: 404 The Spa • Melksham, Wiltshire • United Kingdom • SN12 6QL
PH: 01225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/3996_Tip ... ound-.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat