JavaBlog.fr / Java.lu DEVELOPMENT,Java,Tools Tomcat 6 : Windows Service : Tools

Tomcat 6 : Windows Service : Tools

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:
article-tomcat-windows-service-1

– 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:
article-tomcat-windows-service-3

article-tomcat-windows-service-4

article-tomcat-windows-service-5

article-tomcat-windows-service-6

article-tomcat-windows-service-7

First, we will start the cmd.exe like administrator:
article-tomcat-windows-service-2

So, we will expose the Tomcat server like Windows server with the below command (IS = Install Service):

01tomcat6 //IS//Tomcat6HUO --DisplayName="Apache Tomcat JAVABLOG.FR" --Install="C:\MyFiles\Development\Java\tools\TomCat\bin\tomcat6.exe"
02--Description="This is my Tomcat server as windows service"
03--Jvm="C:\Program Files\Java\jre6\bin\server\jvm.dll"
04--StartMode=jvm
05--StartClass=org.apache.catalina.startup.Bootstrap
06--StartPath="C:\MyFiles\Development\Java\tools\TomCat"
07--StopMode=jvm
08--StopClass=org.apache.catalina.startup.Bootstrap
09--StopPath="C:\MyFiles\Development\Java\tools\TomCat"
10--Classpath="C:\Program Files\Java\jdk1.6.0_32\lib\tools.jar;
11C:\MyFiles\Development\Java\tools\TomCat\lib\servlet-api.jar;
12C:\MyFiles\Development\Java\tools\TomCat\bin\bootstrap.jar;
13C:\MyFiles\Development\Java\tools\TomCat\bin\tomcat-juli.jar"
14--StdOutput="C:\MyFiles\Development\Java\tools\TomCat\logs\catalina.out"
15--StdError="C:\MyFiles\Development\Java\tools\TomCat\logs\stderr.log"
16++StartParams=start
17++StopParams=stop

Then, it is possible to update the Windows service configuration (US = Update Service):

1tomcat6 //US//Tomcat6HUO
2++JvmOptions="-Xrs;-Dcatalina.base=C:\MyFiles\Development\Java\tools\TomCat;
3-Dcatalina.home=C:\MyFiles\Development\Java\tools\TomCat;
4-Dwtp.deploy=C:\MyFiles\Development\Java\tools\TomCat\webapps;
5-Djava.endorsed.dirs=C:\MyFiles\Development\Java\tools\TomCat\endorsed;
6-Djava.security.auth.login.config=C:\MyFiles\Development\Java\tools\TomCat\conf\jaas.config;
7-Dcom.sun.management.jmxremote.port=18080;
8-Dcom.sun.management.jmxremote.authenticate=false"

For information, it is possible to use environnement variables:

1C:\MyFiles\Development\Java\tools\TomCat\bin>echo %JAVA_HOME%
2C:\Program Files\Java\jdk1.6.0_32

For example, we could use the JAVA_HOME variable:

1--Classpath=%JAVA_HOME%\lib\tools.jar;
2or
3--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):

1tomcat6 //DS//Tomcat6HUO

The result should be :
article-tomcat-windows-service-82

The properties of Tomcat service are:
article-tomcat-windows-service-9

…and when we try to start the service, we obtain the following error:
article-tomcat-windows-service-10

==> 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

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

Related Post