Service Creation
-
Open a cmd terminal and change the current directory to the following:
%CATALINA_HOME%\bin
In this directory you will find the following files:
- tomcat8.exe
- tomcat8w.exe
-
Copy the file tomcat8w.exe to CustomTomcat8w.exe.
tomcat8w.exe is in the following pattern:
<SERVICE_NAME>w.exe
This makes the default service name set to tomcat8. Copying it to CustomTomcat8w.exe makes a service name of CustomTomcat8.
-
Set the basic properties of the CustomTomcat8 service using the following command:
tomcat8.exe //IS//CustomTomcat8 --DisplayName="Apache Custom Tomcat 8" --Install="%CATALINA_HOME%\bin\tomcat8.exe" --StartMode=jvm --StopMode=jvm --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop --Description="Apache Custom Tomcat 8 by Ron"
-
Set the classpath using the following command:
tomcat8.exe //US//CustomTomcat8 --Classpath="%CATALINA_HOME%\bin\bootstrap.jar;%CATALINA_HOME%\bin\tomcat-juli.jar"
-
Set the JVM to use using the following command:
tomcat8.exe //US//CustomTomcat8 --Jvm="%JAVA_HOME%\jre\bin\server\jvm.dll"
-
Set some JVM options using the following command:
tomcat8.exe //US//CustomTomcat8 --JvmOptions="-Dcatalina.home=%CATALINA_HOME%;-Dcatalina.base=%CATALINA_HOME%"
-
Set logging using the following command:
tomcat8.exe //US//CustomTomcat8 --LogLevel="Info" --LogPrefix="custom_tomcat8_service-" --LogPath="%CATALINA_HOME%\logs" --StdOutput="auto" --StdError="auto" --PidFile="tomcat8.pid"
-
Set JVM memory using the following command:
tomcat8.exe //US//CustomTomcat8 --JvmMs=512 --JvmMx=1024
Service Post Creation
-
Using the file explorer, find the directory specified by your CATALINA_HOME environment variable and add the LOCAL SERVICE group on the security. Also add the permissions Full Control and Modify to it.
For example if your CATALINA_HOME is pointing to C:\dev\tools\apache-tomcat-8.5.64 directory, expect something like the following as an output:
-
Using the file explorer, navigate to %CATALINA_HOME%\bin directory and double click the CustomTomcat8w.exe file. Click the Java tab and ensure that the Java Virtual Machine field was correctly set. If not, update it accordingly.
For example if your JAVA_HOME is pointing to C:\Program Files\Java\jdk1.8.0_271 directory, ensure that the Java Virtual Machine field is pointing to the correct location of the jvm.dll.
Service Execution
-
Open a cmd terminal and change the current directory to the following:
%CATALINA_HOME%\bin
-
Run the CustomTomcat8 service using the following command:
tomcat8.exe //RS//CustomTomcat8
Service Termination
-
Open a cmd terminal and change the current directory to the following:
%CATALINA_HOME%\bin
-
Stop the CustomTomcat8 service using the following command:
tomcat8.exe //SS//CustomTomcat8
Service Removal
-
Open a cmd terminal and change the current directory to the following:
%CATALINA_HOME%\bin
-
Remove the CustomTomcat8 service using the following command:
tomcat8.exe //DS//CustomTomcat8
Windows Services App
After the service creation was completed and without any error, we can also manage the service using the windows services app. Just look for the value of the --DisplayName parameter (i.e. Apache Custom Tomcat 8) when setting the basic properties of the service. This is depicted as follows by the following snapshot:
Recent Comments