English

How To: Configure Jakarta-Tomcat 3.2.x to start as a Windows service using jk_nt_service.exe

Summary

This document provides an alternative method to create and start Jakarta-Tomcat 3.2.x as a Windows service. Consider following these steps if you have been unable to start Jakarta-Tomcat by the "Tomcat321service.bat" method described in other technical articles.

Procedure

1. Follow the steps below only after you have first confirmed that Jakarta-Tomcat will work in cooperation with your Web server.

a) Run the startup.bat file from either Windows Explorer or a command window prompt. The file is located at <drive>:\jakarta-tomcat-3.2.x\bin.

b) A command window should appear. Wait until seven lines similar to the following are displayed:

<b>2002-06-28 14:25:38 - ContextManager: Adding context Ctx( /examples )
2002-06-28 14:25:38 - ContextManager: Adding context Ctx( /admin )
Starting tomcat. Check logs/tomcat.log for error messages
2002-06-28 14:25:38 - ContextManager: Adding context Ctx( )
2002-06-28 14:25:38 - ContextManager: Adding context Ctx( /test )
2002-06-28 14:25:47 - PoolTcpConnector: Starting HttpConnectionHandler on 8080
2002-06-28 14:25:47 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007</b>

c) Open a browser and enter the following in the address bar:

<b>http://<your-web-server>/examples/servlet/HelloWorldExample</b>

d) If the "Hello World" page does not display, Jakarta-Tomcat and/or your Web server have not been configured properly.

e) Run the shutdown.bat file. The command window with the seven lines should exit at this point.

f) Do not proceed beyond these steps until this test is successful.

2. Download the file jk_nt_service.exe from the Jakarta-Tomcat Index (see the Related Information section below) and save it in the <drive:>\jakarta-tomcat-3.2.x\bin folder.

Note:
From the Index, browse to your installed version of tomcat > bin > win32 > i386 for the jk_nt_service.exe file.

3. In Windows Explorer, browse to <drive:>\jakarta-tomcat-3.2.x\conf, open the wrapper.properties file in a text editor such as Wordpad, then make the following edits:

Code:
wrapper.tomcat_home=C:\jakarta-tomcat-3.2.x
wrapper.java_home=C:\jdk1.3.0_02


Note:
If you placed Jakarta-Tomcat or the Java Development Kit (JDK) in a different location, enter the correct path.

4. Further down in wrapper.properties, find the following section:

Code:
wrapper.class_path=$(wrapper.tomcat_home)\classes
wrapper.class_path=$(wrapper.tomcat_home)\lib\jaxp.jar
wrapper.class_path=$(wrapper.tomcat_home)\lib\crimson.jar
wrapper.class_path=$(wrapper.tomcat_home)\lib\webserver.jar
wrapper.class_path=$(wrapper.tomcat_home)\lib\servlet.jar
wrapper.class_path=$(wrapper.tomcat_home)\lib\jasper.jar

Depending on the version of Jakarta-Tomcat you have installed, there may be a difference between these references and the *.jar files listed in <drive>:\jakarta-tomcat-3.2.x\lib. For example, instead of referencing crimson.jar, the wrapper.properties entry could be referencing parser.jar.

Ensure that the entries in wrapper.properties correspond exactly with the contents of the lib directory.

5. Save the wrapper.properties file and close Wordpad.

6. Open a DOS prompt and change directories to <drive:>\jakarta-tomcat-3.2.x\bin. Enter the following command:

     jk_nt_service -i Jakarta C:\jakarta-tomcat-3.2.x\conf\wrapper.properties

This will create a service named Jakarta. If you prefer, you could name it Tomcat.
Note:
If you placed Jakarta-Tomcat in a different location, enter that information.

7. Click Start > Settings > Control Panel and open the Services Control Panel.

8. Select the Jakarta service and click Start.

Note:
If the service fails to start, check wrapper.properties to ensure you are pointing to the correct Jakarta-Tomcat and JDK locations.

9. If the service starts, click on the Startup button and change the Startup type to Automatic. Click OK.

10. Close the Services Control Panel.

11. If you need to delete the Jakarta service, stop it and use the following command at the appropriate prompt:

Code:
<drive:>\jakarta-tomcat-3.2.x\bin> jk_nt_service -r Jakarta


Note:
The '-r' option will remove the Jakarta service.

Related Information