Solved

Can I run Tomcat as an Service?

Posted on 2004-04-14
5
36,985 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 52

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DNS 2008 standard 2 90
Choosing VM roles in Hyper-V 3 170
Can I clean log of  running tomcat 7 server ? 3 128
Remote desktop Services Recomended setting 4 102
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 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