wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Tomcat virtual hosting, does each host need it's own subdirectory off webapps? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat virtual hosting, does each host need it Watch "Tomcat virtual hosting, does each host need it New topic
Author

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

Tim George
Greenhorn

Joined: Jan 09, 2009
Posts: 6
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat virtual hosting, does each host need it's own subdirectory off webapps?