Search code examples
javawindowstomcattomcat8

Starting Tomcat 8 service on Windows 7 issue: "Failed creating java"


Starting Tomcat 8 as a service on a Windows 7 computer for development purpose can be really annoying.

I had this error:

Failed creating java C:\Program Files (x86)\Java\jdk1.8.0_40\jre\bin\server\jvm.dll

And I saw in C:\Program Files (x86)\Java\jdk1.8.0_40\bin that the msvcr100.dll wasn't the same file I had in my Windows\System32 folder. In fact, in my Windows\System32 folder, I had the msvcr100.dll that corresponds to the x64 version. The Tomcat service wouldn't start and told me that it is not a valid 32-bit version.

What I did to solve this was to install jdk1.8.0_40 in C:\Program Files, open up tomcat8w.exe and under the Java tab, set the Java Virtual Machine path to:

C:\Program Files\Java\jdk1.8.0_40\jre\bin\server\mvcr100.dll

Now, for the Tomcat8 service, it would use the x64 DLL, and all work correctly.

My question is, could I replace the msvcr100.dll safely in Windows\System32 with the x86 version instead? Or is my solution better?


Solution

  • Replacing lib is not a very good solution, because there are no guarantees that it will work correctly with other programs. I propose to just download a new version of this lib in a separate directory and try linking it to Tomcat.

    Furthermore, looks like it is a known issue:

    This usually happens because of missing msvcr71.dll file. However, Tomcat doesn't use msvcr71.dll directly, it's used by the Java Virtual Machine (JVM).

    Solution:

    1. Copy msvcr71.dll from Java's bin directory to Tomcat's bin folder.

    2. Add Java's bin directory to Windows environment variable.

    3. Copy msvcr71.dll from Java's bin directory to windows\system32 folder.

    4. Make sure your Tomcat is pointing at the correct jvm.dll folder.

    enter image description here