简体   繁体   中英

Running Multiple Tomcat Instances on One Windows Machine

I downloaded apache-tomcat-6.0.35 & put it in tomcat folder.

I did accroding to to this: http://builddeploy.blogspot.com/2010/02/running-multiple-tomcat-instances-on.html

My tomcat directory structure is

 tomcat
     apache-tomcat-6.0.35  
           bin,conf,lib,logs,temp,webapps,work   //Folders name
     tomcatclpl
           bin,conf,logs,temp,webapps,work  //Folders name
     tomcatmass
           bin,conf,logs,temp,webapps,work   //Folders name

and apache-tomcat-6.0.35's server.xml file port is 8085

<Server port="8005" shutdown="SHUTDOWN">

and

<Connector port="8005" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

and tomcatclpl's conf - server.xml file I have changed following

<Server port="8205" shutdown="SHUTDOWN">

and

<Connector port="8282" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> and <Connector port="8209" protocol="AJP/1.3" redirectPort="8443" />

same like tomcatmass also i have changed the port as 8383 .

My starup.bat file is:

     @echo off
@echo Tomcat CLPL Service
set "CATALINA_BASE = C:\Tomcat\tomcatclpl"
set "CATALINA_HOME=C:\Tomcat\apache-tomcat-6.0.35"
C:\Tomcat\tomcatclpl\bin\startup.bat

When I run in cmd line;

C:\Tomcat\tomcatclpl>startup.bat
Tomcat MASS Service
Using CATALINA_BASE:   "C:\Tomcat\tomcatclpl"
Using CATALINA_HOME:   "C:\Tomcat\tomcatclpl"
Using CATALINA_TMPDIR: "C:\Tomcat\tomcatclpl\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.6.0_01"
Using CLASSPATH:       "C:\Tomcat\tomcatclpl\bin\bootstrap.jar"
C:\Tomcat\tomcatclpl>

This `bootstrap.jar file not started. Please help me out.

Because of the reason CATALINA_BASE & CATALINA_HOME taking same path I couldn't to fixed this problem

I sort out the problem. First we should start the default tomcat server. Then only need to start instance servers

 @echo off
 @echo Tomcat CLPL Service
 set "CATALINA_HOME=C:\Tomcat\apache-tomcat-6.0.35"
 set "CATALINA_BASE=C:\Tomcat\tomcatclpl"
 C:\Tomcat\apache-tomcat-6.0.35\bin\startup.bat
edit startup.bat
set CATALINA_BASE=..
set CATALINA_HOME=@catalina.home@
set CATALINA_OPTS=-server -Xms@jvm.minmemory@m -Xmx@jvm.maxmemory@m
"%CATALINA_HOME%\bin\catalina" run %1 %2 %3 %4 %5 %6 %7 %8 %9

More info can be found on Configuring Separate Instances Using CATALINA_BASE

@echo off
@echo Tomcat CLPL Service
set CATALINA_BASE="C:\Tomcat\tomcatclpl"
set CATALINA_HOME="C:\Tomcat\apache-tomcat-6.0.35"
C:\Tomcat\tomcatclpl\bin\startup.bat

This the way I normally sets the env variables

Let me fill this one out;

  • You unpack the tomcat zip twice, into two different folders
  • Go open commandpromt as administrator
  • navigate to 'tomcat1'\\bin\\
  • run service install tomcat1
  • navigate to 'tomcat2'\\bin\\
  • call on the commandline: set "CATALINA_HOME=C:\\path\\to\\tomcat2\\"
  • run service install tomcat2

Now you will see two services in your environment (the services.msc). Each called by the X being 1 or 2 as such: "Apache Tomcat tomcatX". They have the correct base/home variable and should point to the correct lib\\ folder (thus bootstrap.jar is available to start the server with).

Problem is, the tool tomcat6w.exe with which you can control the service. It will only function (at least for me) with the default server, namely the first service installed. To bypass this and get the opportunity to define variables to the java environment, we need to find stuff with regedit.exe

  • Navigate the registry for: HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Apache Software Foundation\\Procrun 2.0\\tomcat1\\Parameters\\Java
  • set Options / Xms / Xmx
  • figure out the rest (find tomcat2 in same tree)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM