This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Tomcat virtual hosting, does each host need it's own subdirectory off webapps?

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the Apache web server 2.2, mod_jk 1.2, and Tomcat 6 to serve several webapps, each on a different subdomain.

I deploy the webapps as .war files into the tomcat/webapps directory. I would like to keep this arrangement if possible as it makes things simpler for support staff if they have to update or redeploy a webapp.

Apache/mod_jk is working fine, as is direct access to the webapps via Tomcat, but I haven't fully understood the Tomcat documentation regarding Hosts, Contexts and Autodeployment.

This is what I've tried:
- Set each server.xml Host appBase to the full path of the deployed webapp, Tomcat doesn't find the context descriptor of the webapp. Testing the URL gives me a blank page.
- Add a server.xml Context element to each host. This works, but requires a Tomcat restart each time a webapp is deployed, and is not recommended in the documentation.
- Set each Host appBase to the base directory (tomcat/webapps/) then how can the Host tell which webapp it should serve?

Is the only option to give each Virtual Host its own subdirectory and deploy war files under the correct subdirectory? I'm guessing it is, but it would be great to just drop war files in a single location and have them autodeploy in their corresponding vhosts.

Many Thanks
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!