Technical Recipes

How to set up separate Tomcat instance on Windows

Assume that you have installed the Tocmat application server on your local Windows under $CATALINA_HOME directory (e.g. c:\apache-tomcat-7.0.29)

1. Create a $CATALINA_BASE directory
	e.g. c:\programdata\Tomcat\apache-tomcat-7.0.29

2. Create the following sub-directories for instance 'data-example1' under $CATALINA_BASE\data-example1
	\conf, \lib, \logs, \temp, \webapps, \work

3. Create startup.bat and shutdown.bat under $CATALINA_HOME\bin

	3.1 startup-lac.bat:
	
	set CATALINA_BASE=C:\ProgramData\Tomcat\apache-tomcat-7.0.29\data-lac
	set CATALINA_HOME=C:\apache-tomcat-7.0.29
	C:\apache-tomcat-7.0.29\bin\startup.bat
  	
	3.2 shutdown-lac.bat:
	
	set CATALINA_BASE=C:\ProgramData\Tomcat\apache-tomcat-7.0.29\data-lac
	set CATALINA_HOME=C:\apache-tomcat-7.0.29
	C:\apache-tomcat-7.0.29\bin\shutdown.bat
  	
4. Copy the following files from $CATALINA_HOME\conf to CATALINA_BASE\data-example1\conf
	
	server.xml
	web.xml
	tomcat-user.xml
	
5. Modify server.xml
	
	<Server port="8012" shutdown="SHUTDOWN">
	<Connector port="8812" protocol="HTTP/1.1">
	<Connector port="6612" protocol="AJP/1.3" redirectPort="8443" />
	
6. Copy log4j.properties to $CATALINA_BASE\data-example1\lib

	You may need to add additional .jar file to support log4j. Or you can use some other mechanism to do logging.

7. Copy /ROOT and /manager from $CATALINA_HOME\webapps to $CATALINA_BASE\data-example1\webapps

8. Modify tomcat-user.xml to make use of manager
	
    <role rolename="manager-gui"/>
    <user username="admin" password="xxxxxx" roles="manager-gui"/>
	
9. Run startup.bat and shutdown.bat to test

10. Verify the server is available

	Open the following link in browser and see the Tomcat home page
	http://localhost:8812/
    From Home page, click "Manager" and login as "admin/xxxxxx" to see the Management page