tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Multiple Tomcat Instances
Date Wed, 16 Jun 2010 19:38:01 GMT
Leo Donahue - PLANDEVX wrote:
> 
> Tomcat zip dir:
> C:\ApacheTomcat\apache-tomcat-6.0.26\bin
> In here I created a setenv.bat that has the following: set "CATALINA_BASE=%C:\Catalina_Base1%"
> 
> C:\Catalina_Base1\
> ** \conf
> ** \logs	(automatically added when I ran C:\ApacheTomcat\apache-tomcat-6.0.26\bin\startup.bat)
> ** \webapps
> ** \work	(automatically added when I ran C:\ApacheTomcat\apache-tomcat-6.0.26\bin\startup.bat)
> 
> C:\Catalina_Base1\conf
> ** I copied the contents of \conf from C:\ApacheTomcat\apache-tomcat-6.0.26\conf
> ** I changed the shutdown port to 8006, HTTP port to 8081, and AJP Port to 8010 in server.xml
> 
> C:\Catalina_Base1\webapps\ROOT  
> ** I edited the index.html to indicate I'm using the html file from Catalina_Base1
> 
> http://localhost:8081  
> produces the edited index.html file from C:\Catalina_Base1\webapps\ROOT  Very cool by
the way.
> 
> Ok, so how do I get specify multiple CATALINA_BASE options in the setenv.bat in C:\ApacheTomcat\apache-tomcat-6.0.26\bin
?
> 
> This doesn't work:  set "CATALINA_BASE=%C:\Catalina_Base1%;%C:\Catalina_Base2%;%C:\Catalina_Base3%"

No wonder.
I am starting to think that you do this on purpose..

Maybe having a good look at the startup.bat and catalina.bat files would help.
It looks like setting CATALINA_BASE in setenv.bat is too late, so I would
suggest as follows :

1) at the system level, define a "system variable"
CATALINA_HOME = C:\ApacheTomcat\apache-tomcat-6.0.26
Do NOT define CATALINA_BASE there.
Do NOT define CATALINA_BASE in C:\ApacheTomcat\apache-tomcat-6.0.26\bin\setenv.bat
2) create
- c:\catalina_base1
- c:\catalina_base2
etc.. (as many as you want instances)
- under each. create \bin and \conf and \webapps
- copy the files from C:\ApacheTomcat\apache-tomcat-6.0.26\conf to each \conf and modify 
ports as required
- install under the various \webapps whichever applications you want to run in that instance
3) in one of the new \bin dirs, create a duplicate of the main startup.bat, shutdown.bat 
and setenv.bat
4) modify the new startup.bat.
Just before this line :

rem Guess CATALINA_HOME if not defined

insert these 15 lines :

rem modified LD 2010/06/16
rem upon great and free suggestion of tomcat-users list
rem to set CATALINA_BASE to this specific instance
set "CATALINA_BASE=%cd%"
if exist "%CATALINA_BASE%\conf" goto okBase
cd ..
set "CATALINA_BASE=%cd%"
if exist "%CATALINA_BASE%\conf" goto okBase
echo The CATALINA_BASE environment variable could not be set correctly
echo This environment variable is needed to run this program
goto end

:okBase
cd "%CATALINA_BASE%\bin"

and save the file.

5) do similarly for shutdown.bat (just to be neat and consistent)
6) copy these new startup.bat, shutdown.bat, setenv.bat to each
of your new \bin directories.
6) now open a command window, do a cd to one of your c:\catalina_base1,2,3\bin 
directories, type "startup.bat" and enjoy.
Repeat for the other instances.

Report here if that does not work, cause I don't feel like testing it right now.






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message