  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Struts - A MVC web framework | | Tomcat - JSP/Servlet container | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | | JSP - A mailing list about Java Server Pages specification and reference | |
Struts & Hibernate
|
|
|
  | | | How to: Tomcat 5.0.16 as Windows Service | How to: Tomcat 5.0.16 as Windows Service 2003-12-23 - By Jacob Kjome
Back Thanks for the script, Bill. I've been looking for something that actually works and this finally does....almost....
The script is missing one important thing. It doesn't include %JAVA_HOME%\lib\tools.jar in the --ImagePath which causes JSP compilation to fail. Attached is a modified script that fixes that and adds -Djava.io.tmpdir and adds some -Xms and -Xmx stuff. BTW, I tried adding -server, but the service wouldn't start when it was added. Any idea why? How else do I specify Tomcat to use the -server JVM rather than the default -client?
Jake
At 08:47 PM 12/22/2003 -0800, you wrote: >One of the other developers added the attached .bat file to make it easier >to install as a service (I renamed the attachment to '.txt', since a lot of >mail servers strip '.bat' attachments :). rename it back to '.bat', and see >if it help. > > Usage: service.bat install/remove [service_name] > >service_name defaults to Tomcat5 if not specified. > >"Merrill Cornish" <merrill.cornish@(protected)> wrote in message >news:16035281.1072104979781.JavaMail.root@(protected) > > Bill, > > > > Yes, I should have thought of the --StdOutFile and --StdErrorFile >arguments. However, specifying them does no good. The files are created, >but they are empty. > > > > Merrill > > > > > > >-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ >To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected) >For additional commands, e-mail: tomcat-user-help@(protected)
@(protected) off if "%OS%" == "Windows_NT" setlocal rem -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- rem NT Service Install/Uninstall script rem rem Options rem install Install the service using Tomcat5 as service name. rem Service is installed using default settings. rem remove Remove the service from the System. rem rem name (optional) If the second argument is present it is considered rem to be new service name rem rem $Id: service.bat,v 1.1 2003/12/22 13:48:52 mturk Exp $ rem -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
rem Guess CATALINA_HOME if not defined set CURRENT_DIR=%cd% if not "%CATALINA_HOME%" == "" goto gotHome set CATALINA_HOME=%cd% if exist "%CATALINA_HOME%\bin\tomcat.exe" goto okHome rem CD to the upper dir cd .. set CATALINA_HOME=%cd% :gotHome if exist "%CATALINA_HOME%\bin\tomcat.exe" goto okHome echo The tomcat.exe was not found... echo The CATALINA_HOME environment variable is not defined correctly. echo This environment variable is needed to run this program goto end :okHome
set EXECUTABLE=%CATALINA_HOME%\bin\tomcat.exe
rem Set default Service name set SERVICE_NAME=Tomcat5
if "%1" == "" goto displayUsage if "%2" == "" goto setServiceName set SERVICE_NAME=%2 :setServiceName if %1 == install goto doInstall if %1 == remove goto doRemove echo Unknown parameter "%1" :displayUsage echo echo Usage: service.bat install/remove [service_name] goto end
:doRemove rem Remove the service %EXECUTABLE% //DS//%SERVICE_NAME% echo The service '%SERVICE_NAME%' has been removed goto end
:doInstall rem Install the service %EXECUTABLE% //IS//%SERVICE_NAME% --DisplayName "Apache Tomcat" --Description "Apache Tomcat Server - http://jakarta.apache.org/tomcat/" --Install " %EXECUTABLE%" --ImagePath "%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\bin \bootstrap.jar" --StartupClass org.apache.catalina.startup.Bootstrap .html>org.apache.catalina.startup.Bootstrap org.apache.catalina.startup.Bootstrap .java.html> ' border=0>;main;start --ShutdownClass org.apache.catalina.startup.Bootstrap .html>org.apache.catalina.startup.Bootstrap org.apache.catalina.startup.Bootstrap .java.html> ' border=0>;main;stop --Java java - -Startup manual rem Set extra parameters %EXECUTABLE% //US//%SERVICE_NAME% --JavaOptions -Dcatalina.home="\"%CATALINA _HOME%\""#-Djava.endorsed.dirs="\"%CATALINA_HOME%\common\endorsed\""#-Djava.io .tmpdir="\"%CATALINA_HOME%\temp\""#-Xms32m#-Xmx256m#-Xrs --StdOutputFile " %CATALINA_HOME%\logs\stdout.log" --StdErrorFile "%CATALINA_HOME%\logs\stderr.log " --WorkingPath "%CATALINA_HOME%\bin" echo The service '%SERVICE_NAME%' has been installed
:end cd %CURRENT_DIR%
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected) For additional commands, e-mail: tomcat-user-help@(protected)
|
|
 |