Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I cannot automatically start the Tomcat7 service at startup on my Windows 7 laptop. On restarting Windows, I get the message "Access is Denied. Unable to Open the Service Tomcat7" even though I have the service set to log in as Administrator.

I've also set the Tomcat directory (which I located outside of the Program Files directories) and all its subdirectories to "Full Control" for all users (which should be overkill). Yet I can start it manually using the "Run as Administrator" context menu item.

If that works, why won't setting it to run as Administrator as a service work?

share|improve this question

5 Answers 5

up vote 4 down vote accepted

I was getting the very same error and I managed to sort it out. Though in my case, even though the same error occurred on every start of the machine, the service was running, as I was able to use my app. But I seriously wanted to get rid of this problem so the client will not be forced to see this annoying error.

The way I did it was set up the tomcat7w.exe to always start as an administrator. Exactly you do it in the following way: to right click on the tomcat7w.exe which is in 'bin' folder of the tomcat installation, select 'Properties', then in 'Compatibility' tab under 'Privilege Level' select the 'Run this program as an administrator'.

I have put my answer for completeness as I think this might be the only way for Win 7 Home users, as in this version there is simply no option to set Local Policies which is required in the answer provided by @ta.speot.is (BTW +1)

share|improve this answer

If that works, why won't setting it to run as Administrator as a service work?

Presumably Administrator doesn't have Log on as a service granted to it.

share|improve this answer
    
Since I'm using Windows 7 Home Premium (I'm trying to run Tomcat so i can run the Endeavour Mgmt application), the "Users and Groups" applet is not present. The solution I found was to download the Windows Server 2003 Resource Kit (thanks to this blog post) and use the ntrights.exe utility to set the correct permissions (ntrights.exe instructions). –  chrysanhy May 19 '11 at 17:52

Alternatively to Blomkvist's answer, you can use msconfig.exe to disable the startup of "Commons Daemon Service Manager" (Tomcat7w.exe). It won't run properly anyway during startup when you have "Run As Administrator" enabled.

Some Background regarding the default installation of Tomcat7 with Service:
Tomcat7w.exe is Apache's "Commons Daemon Service Manager". By default, it is configured to run during startup, under the current user. It tries to connect to the Tomcat7.exe Service, which by default runs as user "SYSTEM". The problem is, the current user has not enough privileges to manipulate services or processes of user SYSTEM.

You may disable the "Commons Daemon Service Manager". It only provides convenience remote control of the service process. You can achieve all the same by using the Services administrative tool, or the command line net or sc command. Put these in a batch file and change it's property to Run As Administrator (They must be run with Administrator privileges as well.)

net stop "Tomcat7"
net start "Tomcat7"
share|improve this answer

If you're having trouble with the tray icon, then just run Monitor Tomcat under the Start Menu. It will appear as it does after the installation. Damn, it feels good starting/stopping the service that way

share|improve this answer

Right click on the tomcat7w.exe (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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.