I have the following problem configuring tomcat 7 to run as a service on windows.
More specifically, tomcat is part of a web application which is installed on our customers' servers, and it must have all of its dependencies inside.
In this case, tomcat depends on the Java JDK/JRE, so I downloaded a standalone jdk (version 1.7u21) with its jre and placed it inside the tomcat folder.
So now my directory tree is like this:
tomcat7
- bin
- conf
- jdk
- jre
- logs
- temp
- webapps
- work
I then proceeded installing it as a service using the command
tomcat\bin\service.bat install
And it gets installed with no problem, in jvm
mode.
Please note that I modified the service.bat file so that all the needed variables are correctly set, that is, CATALINA_HOME, CATALINA_BASE, JAVA_HOME and JRE_HOME, and the last two point to the internal jdk/jre.
However, if I try to start the service, I get an error which says that it is unable to start the service and refers to error code 1.
Looking in the tomcat logs, it says:
[2013-05-22 12:22:09] [info] [ 5392] Commons Daemon procrun (1.0.15.0 32-bit) started
[2013-05-22 12:22:10] [info] [ 5392] Running 'AGEws2Tomcat7' Service...
[2013-05-22 12:22:10] [info] [ 2764] Starting service...
[2013-05-22 12:22:10] [error] [ 2764] %1 is not a valid Win32 application.
[2013-05-22 12:22:10] [error] [ 2764] Failed creating java C:\AGEws\tomcat7\jdk\jre\bin\server\jvm.dll
[2013-05-22 12:22:10] [error] [ 2764] %1 is not a valid Win32 application.
[2013-05-22 12:22:10] [error] [ 2764] ServiceStart returned 1
[2013-05-22 12:22:11] [error] [ 2764] %1 is not a valid Win32 application.
[2013-05-22 12:22:11] [info] [ 5392] Run service finished.
[2013-05-22 12:22:11] [info] [ 5392] Commons Daemon procrun finished
I tried googling a bit about the part Failed creating java
and I found out some information about a possible dependency on a .dll
file, which I have found but I do not understand where should I place it, if this is indeed the problem.
I also tried installing the service in java
mode, and it works but uses my computer's own JVM instead of the internal one, while I need it to use the internal one.
What can/must I do in order to have tomcat work properly as a service in jvm
mode, using its own jdk/jre?
Please note that our web application used to ship with tomcat 5, which worked perfectly in jvm
mode.