The case of the annoying Tomcat 6 Monitor

Ever since installing Tomcat 6 on my Windows 7 machine at home I’ve had an annoying message box pop up every time I restart my machine: Access is denied. Unable to open the service ‘Tomcat6′. Since it takes less time and effort to click on OK than to sort out the problem that is exactly what I have been doing … but enough is enough.

Access is denied

Tomcat IS running – so what is causing this error?

I confirmed that the Tomcat 6 service was running even though I got this message box – so what was causing it ? It turns out that Tomcat 6 Monitor Application was causing this error. Tomcat 6 Monitor Application is a GUI for monitoring and configuring the Tomcat 6 Service. It needs to be executed by the Administrator user and the UAC is getting in the way at start up time.

Are you feeling brave ?

The only solution I have found to work so far is to remove the Tomcat 6 Monitor Application from the Windows startup. And the only way to do this is to remove a registry entry …

Fire up regedit (Start Menu > Search programs and files > regedit.exe) and remove the following key:

  • Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

567

Now you should not see this annoying message box every time Windows starts up. But it also means that Tomcat 6 Monitor will not be started on Windows startup.

Running Tomcat 6 Monitor manually

You may still want to run the Tomcat 6 Monitor since it does provide nice shortcuts for configuring and monitoring the state of your Tomcat 6 service. You can execute the Tomcat 6 Monitor via Run as administrator or you can configure the shortcut in the Start Menu to always execute the application as administrator.

Find the shortcut to the Tomcat 6 Monitor in the Start Menu (Start Menu > Apache Tomcat 6.0 > Monitor Tomcat) and right-click on it. Select Properties.

2

Click on the Shortcut tab in the Monitor Tomcat Properties window. Click on the Advanced button and check the Run as administrator checkbox.

3

Click Continue on the Dialog that pops up and now you should be able to start the Tomcat 6 Monitor by simply clicking the shortcut in the Start Menu. Windows will still flash the UAC though since you are running this application as administrator.

4

Update: 05 December 2010

The comment by Scot shows once again that there is always more than one way to skin a cat. Thanks Scot.

If you would still like to have the Apache Tomcat Monitor fired up on startup then replace the steps in this post with the following:

  • Leave the registry key ApacheTomcatMonitor at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run untouched. This will ensure that Windows starts up the Tomcat Monitor.
  • Right click on the tomcat6w.exe executable found at %CATALINA_HOME%\bin. Click on the Properties menu item and then select the Compatibility tab. Check the Run this program as an administrator checkbox under the Privilege Level section. Click the OK button.

Run as administrator

When Windows starts up now you will no longer get the Access is denied. Unable to open the service ‘Tomcat6′ message. The UAC will pop up and ask you to confirm the starting of the Apache Tomcat Monitor.

Installing Tomcat 6 on Windows 7

Tomcat is an open source Java Servlet container developed by the Apache Software Foundation. It is bundled with a very capable Java based Web (HTTP) Server.

Which Java to install ?

Tomcat requires Java to be installed – it is afterall a Java Servlet container. Since Tomcat 5.5 the dependency on the JDK (Java Development Kit) for compilation of JSPs (Java Server Pages) has been removed. The Eclipse JDT Java compiler has been bundled with Tomcat to provide this capability. This means that we just need to install the JRE (Java Runtime Environment).

So its a simple decision then – or is it ?

Java Virtual Machines

From the Oracle Java SE Documentation:

The JDKTM provides one or more implementations of the JavaTM virtual machine (VM):

  • On platforms typically used for client applications, the JDK comes with a VM implementation called the Java HotSpotTM Client VM (client VM). The client VM is tuned for reducing start-up time and memory footprint. It can be invoked by using the -client command-line option when launching an application.

  • On all platforms, the JDK comes with an implementation of the Java virtual machine called the Java HotSpot Server VM (server VM). The server VM is designed for maximum program execution speed. It can be invoked by using the -server command-line option when launching an application.

The above documentation and information from other resources on the differences between the Client VM and Server VM suggest that we should be using the Server VM when running Tomcat on a server.

Unfortunately the Server VM is only bundled with the JDK. So we are back to our dependency on the JDK. If you are installing Tomcat on a server and require the optimisations around speed and for long lived processes install the JDK and use the Server VM.

Which Tomcat Binary Distribution ?

Just when you thought it was getting simpler … The Tomcat 6 Downloads page has 6 options for binary distributions.

Pick the 32-bit/64-bit Windows Service Installer option. This distribution is geared towards users planning to launch Tomcat through Windows services and also provides the compiled APR/native library.

Installing

Download and install the Java 6 SE JDK. Remember to install the 64-bit version if you are running on a 64-bit OS. The Tomcat installer will look for a 64-bit Java VM on a 64-bit OS.

Download and install the Tomcat 6.0.29 32-bit/64-bit Windows Service Installer.

Ensure that you select the Service and Native options under the Tomcat component. The Manager application component provides a web based management application.

 Tomcat 3

You will be asked to choose an HTTP connector port for Tomcat and if you chose to install the Manager component you will also be required to configure authentication details for the Manager.

Tomcat 5

When asked to provide the path to the java virtual machine to use, specify the JRE folder of the installed JDK.

Tomcat 6

When the install is complete, the Tomcat service will be automatically started if you chose Run Apache Tomcat in the final screen on the install wizard.

Tomcat 9

Confirm the install

Once the service has started, the Tomcat icon should appear in the taskbar. Right click the icon and select Configure from the menu.

Tomcat 10 Tomcat 11

 

Select the Java tab on the Apache Tomcat 6 Properties window. Confirm that the Server VM (jre6\bin\server\jvm.dll) is being used by Tomcat.

Tomcat 12

Open the Windows Services manager and confirm that the Tomcat service has been correctly installed.

Tomcat 14

Finally confirm that you can communicate with Tomcat on the configured HTTP port. Open http://localhost:8080 in your browser.

Tomcat 15