Solved

Can I run Tomcat as an Service?

Posted on 2004-04-14
5
36,922 Views
Last Modified: 2011-08-18
as the titile.
I don't want to run the startup script again after reboot the server. Can I set the tomcat as an service so that it can be automaticall restarted after rebooting server machine?
0
Comment
Question by:ggyao2003
5 Comments
 
LVL 18

Accepted Solution

by:
JConchie earned 125 total points
ID: 10828538
Found this....can't vouch for it from experience, but it seems worth a try.

October 3, 2003
Run tomcat as a windows service
October 3, 2003
 If you want to run tomcat as a windows service, there are two ways to do it. Once is while installing choose to install as service, or if you already have installed it through command line, then you can run the following command to install tomcat as a service.

%CATALINA_HOME%\bin\tomcat -install "Apache Tomcat" "%JAVA_HOME%\jre\bin\classic\jvm.dll" -Djava.class.path="%CATALINA_HOME%\bin\bootstrap.jar;%JAVA_HOME%\lib\tools.jar" -Dcatalina.home="%CATALINA_HOME%" -Xrs -start org.apache.catalina.startup.Bootstrap -params start -stop org.apache.catalina.startup.Bootstrap -params stop -out "%CATALINA_HOME%\logs\stderr.log"

The above command will install tomcat as a service. If this fails then its possible that tomcat.exe is not there in %CATALINA_HOME%\bin\ directory. You can just download tomcat again and extract tomcat.exe and put this into the directory. ( I was not having this in my tomcat local directory because when installing for the first time I choose NOT to install it as a service).

After installing the service, you can either go to control panel/administrative tools/services and start and stop the service, or you can run it from command line
net start "Apache Tomcat" // to start the service
net stop "Apache Tomcat" // to stop the service.

If you ever want to uninstall tomcat as a service you can run this command
"%CATALINA_HOME%\bin\tomcat.exe" -uninstall "Apache Tomcat"

Service not starting?
When I did this my service did not start properly, and I went to the event viewer log to see the problem. It was not able to find jvm.dll in the path so I had to search and correct the path for dll and things worked just fine. Note that when I made the path change, i had to first uninstall the service and then install it again.  
0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 10831528
You SHOULD able to make a selection whether you want to make your Tomcat server to run as a Service during the installation, i try Tomcat 4.0.6 and it allow me to select this. And this should apply for the Tomcat version above that.

Another workaround is, try to create a batch file that include the run statement of Tomcat, then put the batch file to run at Startup, do it similarly when you create a new entry to Registry at:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

The command of running Tomcat server will be something like:
C:\jdk1402\bin\java.exe -jar -Duser.dir="G:\Tomcat406" "G:\Tomcat406\bin\bootstrap.jar" start

if still not working , try reinstall the Tomcat server, as what JConchie suggested.

regards
0
 
LVL 2

Expert Comment

by:sudev_shetty
ID: 10840622
hey the simple way of doind this is ...
there is a installabe called firedeamon download it and install
then add the "%CATALINA_HOME%\bin\tomcat.exe"  to firedeamon
this will be added in the service
as simple as that :)
0
 
LVL 2

Expert Comment

by:sudev_shetty
ID: 10840629
sorry i forgot to give u the url of that installer
www.firedaemon.com/downloads/
enjoy :)
0
 

Author Comment

by:ggyao2003
ID: 10869112
I found that there is an executable file called "service" under /bin directory. I run it in my local machine and reboot, then the tomcat is set as service.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Convert websphere application server default chained Certificates from 1024 to 2048 keysize or higher size and also you can change signatureAlgorithm . Please make sure Websphere Application Server fixpack 7.0.0.23 or Above. The following steps a…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now