Creating multiple instances of Apache Tomcat on a single windows server

By default you cannot have two Apache Tomcat installations on one windows server. But it is possible; just follow the steps described below:
1) Install your fist apache tomcat instance. This installation will also create windows service.
2) Copy whole Tomcat directory from "C:\Program Files\Apache Software Foundation\Tomcat 5.5" into "C:\Program Files\Apache Software Foundation\Tomcat 5.5.1".
3) Create a new windows service for this new tomcat instance. Unfortunately script (or batch file) that does this not comes with tomcat installation, even though it is stating it does.
Here is the script that you should place under "C:\Program Files\Apache Software Foundation\Tomcat 5.5.1\bin\".
tomcat5 //IS//Tomcat51 --DisplayName="Apache Tomcat 5.5.1" --Install="C:\Program Files\Apache Software Foundation\Tomcat 5.5.1\bin\tomcat5.exe" --Jvm=auto --StartMode=jvm --StopMode=jvm --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop

4) Update C:\Program Files\Apache Software Foundation\Tomcat 5.5.1\conf\server.xml of a new instance (Tomcat 5.5.1) with different ports:
<Server port="8105" shutdown="SHUTDOWN">
<Connector port="8081">
<Connector port="8109" enableLookups="false" redirectPort="443" protocol="AJP/1.3" />
5) After above script will be executed, a new service will be created. Start this new service from windows services or using following command:
"C:\Program Files\Apache Software Foundation\Tomcat 5.5.1\bin\tomcat5w.exe" //MS//Tomcat_2 5.5
6) Open old and new tomcat monitors and configure a new instance with values from old instance.

Running project outside Apache Tomcat webapps folder

Are you looking for running project outside Tomcat webapps folder? If your web application requires functionality where end users can upload content, that can be later downloaded or viewed by others, the best way to accomplish that is to create folder outside of standard tomcat webapps. If you will create such folder as part of your web project under webapps, every time you will deploy your web application (*.war), the content of that directory will be lost (or overridden). Another reason you would like to have folder outside of webapps, if you have multiple tomcat instances and you need to share the content between all these instances. For example, if your visitor submits content with images, the images will be uploaded into particular tomcat instance, that was taking care of this request. If other user wants to see that content, the image will not be available, if this request will be handled by other instance of tomcat. In such cases with clustered or failover configuration there is a need of having shared folder between multiple apache tomcat instances.
The steps below will explain how to configure a context outside of $CATALINA_HOME/webapps.
We will show you by example how to configure apache tomcat to use /downloads that defind outside of your web application.
1) Open C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost
2) Create xml file named downloads.xml with following content:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/downloads" docBase="C:/downloads" debug="0" privileged="true">

In this example any references to will be directed to C:\download directory, and not to C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\your_web_app\downloads

Please leave your comments