Wednesday, October 05, 2005

Tomcat 5 as an NT Service

This really should be much easier than it is, if you fail to update the VM options the thing fails, after a day of work the following example is the only one that worked for me.

install.bat

set JAVA_HOME=C:\j2sdk1.4.2_06
set CATALINA_HOME=c:\tomcat5
set CATALINA_BASE=c:\tomcat5
set EXECUTABLE=tomcat5.exe
set SERVICE_NAME=tomcat5server
set PR_STDOUTPUT=%CATALINA_HOME%\logs\stdout.log
set PR_STDERROR=%CATALINA_HOME%\logs\stderr.log

"%EXECUTABLE%" //IS//%SERVICE_NAME%
--DisplayName=cipc --Install="%CATALINA_HOME%\bin\tomcat5.exe"
--Jvm=auto
--JvmMs=128
--JvmMx=512
--StartMode=jvm
--Classpath="%CATALINA_HOME%\bin\bootstrap.jar;%CATALINA_HOME%\bin\servlet.jar;%JAVA_HOME%\lib\tools.jar"
--StopMode=jvm
--StartClass=org.apache.catalina.startup.Bootstrap
--StartParams=start
--StopClass=org.apache.catalina.startup.Bootstrap
--StopParams=stop

"%EXECUTABLE%" //US//"%SERVICE_NAME%"
--JvmOptions "-Xms128M;-Xmx512M;-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\common\endorsed"
--StartMode jvm
--StopMode jvm

"%EXECUTABLE%" //US//"%SERVICE_NAME%"
++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp"
--JvmMs 128
--JvmMx 512

No comments: