How to run multiple instances of Tomcat in one Windows machine

How to run multiple instances of Tomcat in one Windows machine

January 18th, 2010 by Sanjay Regmi

Sometimes, you might want to run two web applications using Tomcat on one server and want each installation to be separate. This provides isolation of the application and you can change configuration of each one of them separately. Here is a stepwise instruction for the same using Tomcat 6 on Windows 2003 server.

Assumption:
You have a working copy of Java JRE installed on your machine. If not, any JRE above version 5.0 and later is fine. Install it from here, if you need it.

The process:

1. Download Tomcat
Download Tomcat (the core, zipped version) from here and upzip in two different folders, for example c:\tc1 and c:\tc2.

2. Setup environment variable
Go to Start, Control Panel, System, Advanced, Environment Variables, System Variables. Click New. In variable name, input “CATALINA_HOME” and “c:\tc1″ in variable value, without quotes. Then press OK. Again, in System Variables, click New. In Variable name, input “CATALINA_HOME2″ and “c:\tc2″ in variable value, without quotes. Press OK thrice.

3. Setup new CATALINA_HOME variable
Go to c:\tc2\bin directory. Open startup.bat in notepad. Click on the edit menu and then replace. Find all instances of CATALINA_HOME and replace with CATALINA_HOME2. Do the same for catalina.bat and shutdown.bat in c:\tc2\bin.

4. Provide new ports.
Now go to c:\tc2\conf directory and open server.xml in notepad. There are three replacements to be done here.

    1. Find code fragment, “Server port=”8005″ shutdown=”SHUTDOWN”". Replace 8005 with 8105.

    1. Find code fragment, “Connector port=”8080″ protocol=”HTTP/1.1″”. Replace 8080 with 8100.

  1. Find code fragment, “Connector port=”8009″ protocol=”AJP/1.3″ redirectPort=”8443″”. Replace 8009 with 8109.

Note: you can replace with any port number as long as you know it is free.

5. Check installation
You are done setting both the tomcats up. Goto c:\tc1\bin and double-click on startup.bat. Tomcat instance should be up and running. Open up a browser and input http://localhost:8080. You should see the familiar tomcat start page. Then goto c:\tc2\bin\ and double-click on startup.bat. Tomcat instance two should be up and running. Point your browser to http://localhost:8100 and you should again see the tomcat startup page.

You can create as many new instances of tomcat as required by repeating the above steps. Just make sure that all ports that you use (step 4) are free.

Troubleshooting:

    1. Make sure you downloaded the zipped version.

    1. Make sure step 2, which defines tomcat home is done properly.

    1. Check step 3 – the replacement of CATALINA_HOME to CATALINA_HOME2 should be thorough.

  1. The new ports in step 4 (8105, 8100, 8109 ) should all be free.

Let me know if you have a better or a quicker setup method.

 Tweet

Tags: Apache Tomcat, Documentum, Tomcat

5 Responses to “How to run multiple instances of Tomcat in one Windows machine”

  1. Juan Font says:

    Thank you for this article. After being at this for more than 2 hours I easily made this work. My only change was that I was using BEA JROCKIT so had to change my JAVA_HOME to it. Also one of my webapps needed the line :-Dsun.lang.ClassLoader.allowArraySyntax=true
    so I had to add that into the catalina.bat (last lines).

    Thanks again!

     
  2. Juan Font says:

    Opps, parser thought I wanted a smiley. Here is correct line:
    – Dsun.lang.ClassLoader.allowArraySyntax=true

     
  3. Thanks for your input…

     
  4. chetan says:

    Thanks :)
    Very short and Simple steps …

     
  5. jatin Patel says:

    Thanks a lot. Keep up the good work.

 

转载于:https://www.cnblogs.com/fxwdl/archive/2010/10/30/1865331.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值