Solved

Can I run Tomcat as an Service?

Posted on 2004-04-14
5
36,964 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 51

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

830 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