jQuery in Action, 3rd edition
The moose likes Tomcat and the fly likes Tomcat multiple instances or virtual hosts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat multiple instances or virtual hosts" Watch "Tomcat multiple instances or virtual hosts" New topic

Tomcat multiple instances or virtual hosts

Vasilis Karas

Joined: Mar 16, 2004
Posts: 24
We've setup Tomcat(standalone mode) and now are trying to figure out how we can create multiple instances of an Application from one .WAR file.
The purpose for this is to allow for the internal testers to hit a beta release while our development team can integrate and test another (same app) version.
I'm not quite sure how this would be done under Tomcat.
Same application(one .war file), but many versions. Are Virtual Hosts the answer or Should we just install multiple instances of Tomcat?
I'd like to be able to tell the test team to hit a url..for instance.
and our dev team could hit
just different ports....
Any help is appreciated.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

There are two approaches.
The first is to house multiple instances of your app from one instance of Tocmat. To do this, simply rename your war file. Tomcat will deploy the new app within 60 seconds.

The second is to run multiple instances of Tomcat. This is also pretty easy.
Just copy your Tomcat installation and change the ports to something unique in your server.xml file. You will need to change port 8080 and the shutdown port. This approach will allow you to access the different instances by changing the port numbers in the browser's address window as you mentioned in your question.

It's even possible to run multiple instaces of Tomcat from one codebase. Google with 'CATALINA_HOME', 'CATALINA_BASE', and the word 'multiple' and you will find plenty of information on this.

There are some other alternatives as well but these two are the simplest.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Vasilis Karas

Joined: Mar 16, 2004
Posts: 24
Appreciate the quick response.
thanks Ben!
I agree. Here's the link: http://aspose.com/file-tools
subject: Tomcat multiple instances or virtual hosts
It's not a secret anymore!