I have installed Apache Tomcat 7.0.4 on both Windows 7 (64-bit) and Windows Vista (64-bit) along with Java 6 r22.
I used the .exe installer for Tomcat to get the windows service for tomcat. When I start the service it fails with the following error:
Windows could not start the Apache Tomcat 7 on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to the service-specific error code 0.
If i try to start it again, it starts successfully.
When I try to stop the service, I get the following error:
Windows could not stop the Apache Tomcat 7 service on Local Computer.
Error 109: The pipe has been ended.
Everytime after this it takes 2 tries to start the server and fails with the same error on stop. Other than these errors the server itself is working fine.
Running it from the command line acts similarly. When i try to start the server, the first time it does nothing (shows nothing in the command prompt) and starts successfully the second time.
And the event log seems to have the same information as the error popup.
Also, this is a clean install of tomcat with no webapps installed and no other instances of tomcat or java installed. We have now tried this on Windows 7, Vista and Windows Server 2003 (all 64-bit). The 64 bit versions of Tomcat 6 we previously used on these machines had no issues on startup/shutdown.
I did notice one thing. If i delete the tomcat7.pid file from the log directory after shutting down tomcat, i can restart it without doing it twice (This is whats happens when i start the service twice, the first time it deletes the pid file and fails and then it starts correctly the second time).
I'm having the same problem. Once I stop the server, and the error appears, I am not able to edit files in my project. Something seems to be hanging on to the file, so maybe it's not entirely shutting down. If I change the shutdown Mode to "Java" as described above, I am am not able to start the tomcat service.
I have tried Tomcat 6 and Tomcat 7, and am getting the same results. The box tomcat is running on is Windows 2008 R2.
EDIT/UPDATE: I downgraded from 6.0.30 to 6.0.29, and the error goes away. Also, it turns out that the error is benign. the server was actually stopping even though the error occurs. Nothing was hanging on to a file inside the webapps. Permissions was actually keeping me from editing the file.
What fixed this for me is I removed a System.exit call in the destroy method of my servlet. I think tomcat wants to handle ending the application. It doesn't like when you end the application yourself.
As already said by Glenn, replacing the Startup and Shutdown mode by JAva instead of JVM should do the trick for those running tomcat 7.06 +
This can be done by running %TOMCAT_HOME%\bin\tomcat7w.exe and go to the "Startup" and "Shutdown" tabs, then change the "Mode" field from "Jvm" to "Java".
But for those running tomcat 7.04 - you also need to disable the use of the Tomcat.pid file.
This can be done by running %TOMCAT_HOME%\bin\tomcat7w.exe and go to the "Logging" tab, then empty the "PID file" field.
In fact the windows installer automatically configure the use of such a file, but running tomcat as a service fails to delete the file which prevents the service to start again. But it seems that starting the service deletes the file and launching it a second time will succeed.