Hi,
In this article, I will try to expose a Tomcat server installed like Windows service.
We will use Tomcat6, Windows7 and Jdk 6.
First, our Tomcat server is installed in the “C:\MyFiles\Development\Java\tools\TomCat” folder with the following executables:
– Tomcat6 is a service application for running Tomcat6 as NT service.
– Tomcat6w is a GUI application for monitoring and configuring Tomcat services.
Before to expose Tomcat server like Windows service, below the Tomcat server configuration in Eclipse:
First, we will start the cmd.exe like administrator:
So, we will expose the Tomcat server like Windows server with the below command (IS = Install Service):
tomcat6 //IS//Tomcat6HUO --DisplayName="Apache Tomcat JAVABLOG.FR" --Install="C:\MyFiles\Development\Java\tools\TomCat\bin\tomcat6.exe" --Description="This is my Tomcat server as windows service" --Jvm="C:\Program Files\Java\jre6\bin\server\jvm.dll" --StartMode=jvm --StartClass=org.apache.catalina.startup.Bootstrap --StartPath="C:\MyFiles\Development\Java\tools\TomCat" --StopMode=jvm --StopClass=org.apache.catalina.startup.Bootstrap --StopPath="C:\MyFiles\Development\Java\tools\TomCat" --Classpath="C:\Program Files\Java\jdk1.6.0_32\lib\tools.jar; C:\MyFiles\Development\Java\tools\TomCat\lib\servlet-api.jar; C:\MyFiles\Development\Java\tools\TomCat\bin\bootstrap.jar; C:\MyFiles\Development\Java\tools\TomCat\bin\tomcat-juli.jar" --StdOutput="C:\MyFiles\Development\Java\tools\TomCat\logs\catalina.out" --StdError="C:\MyFiles\Development\Java\tools\TomCat\logs\stderr.log" ++StartParams=start ++StopParams=stop
Then, it is possible to update the Windows service configuration (US = Update Service):
tomcat6 //US//Tomcat6HUO ++JvmOptions="-Xrs;-Dcatalina.base=C:\MyFiles\Development\Java\tools\TomCat; -Dcatalina.home=C:\MyFiles\Development\Java\tools\TomCat; -Dwtp.deploy=C:\MyFiles\Development\Java\tools\TomCat\webapps; -Djava.endorsed.dirs=C:\MyFiles\Development\Java\tools\TomCat\endorsed; -Djava.security.auth.login.config=C:\MyFiles\Development\Java\tools\TomCat\conf\jaas.config; -Dcom.sun.management.jmxremote.port=18080; -Dcom.sun.management.jmxremote.authenticate=false"
For information, it is possible to use environnement variables:
C:\MyFiles\Development\Java\tools\TomCat\bin>echo %JAVA_HOME% C:\Program Files\Java\jdk1.6.0_32
For example, we could use the JAVA_HOME variable:
--Classpath=%JAVA_HOME%\lib\tools.jar; or --Classpath="C:\Program Files\Java\jdk1.6.0_32\lib\tools.jar;"
Of course, a service could be delete with the command (DS = Delete Service):
tomcat6 //DS//Tomcat6HUO
The properties of Tomcat service are:
…and when we try to start the service, we obtain the following error:
==> I don’t found the solution of this problem, have you already encountered the same error?
For more information, read the page : http://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html
Thanks in advance,
Huseyin OZVEREN