I’ve run more Tomcat services than I care to think about and I reckon I’ve probably seen just about every different way they can fail now. The failure mode I describe here seems to catch me out every time though so I thought I’d write it up so everyone can benefit from my pain.
If you see error messages like this:
[2013-03-01 08:12:11] [174 javajni.c] [error] The specified module could not be found. [2013-03-01 08:12:11] [986 prunsrv.c] [error] Failed creating java [2013-03-01 08:12:11] [1260 prunsrv.c] [error] ServiceStart returned 1
in your jakarta service log file you have probably hit this issue.
This problem is discussed all over the place but it may be worth reviewing this bug report which discusses the underlying issue. Essentially the problem is that Tomcat launcher somehow ends up with a DLL required for starting the JVM not on it’s path. The solution, therefore, is to make sure that the DLL is on the path.
In your Java bin directory (e.g. C:\Program Files\Java\jre7\bin) you’ll find a DLL called either: msvcr70.dll (Java 6) or msvcr100.dll (Java 7). Copy this file to the bin directory of your Tomcat install. This will cause it to be placed on the path of the Tomcat launcher.
Alternatively you could place the DLL in the appropriate Windows system folder since they are always included on the path. Be careful with this approach though, if you have a 64bit OS you’ll have system folders for both 32bit and 64bit DLL’s. If you install a 64bit version of Java the DLL will have to go into the 64bit system folder and vice versa for 32bit.