The Source for Java Technology Collaboration
User: Password:



Simon Brown

Simon Brown's Blog

Installing Tomcat 4 as an NT service

Posted by simongbrown on September 26, 2003 at 03:57 AM | Comments (18)

While Matt was talking about the Tomcat Service Manager, coincidentally, I was trying to install Tomcat 4 as a service on a Windows 2000 machine yesterday. For various reasons, I didn't want to install Tomcat via the .exe and therefore had to hunt around for the command line that installs the NT service. For (my) future reference, here it is, split over several lines for readability.

set JAVA_HOME=c:\j2sdk1.4.2_01
set CATALINA_HOME=c:\jakarta-tomcat-4.1.27

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


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Java Service Wrapper
    I manage dozens of Tomcat installations at work. At first we had several different mechanisms for launching Tomcat as a service. Ultimately, the one I settled on is the Java Service Wrapper: http://wrapper.tanukisoftware.org/doc/english/index.html

    This is open source (SourceForge hosted) and I believe is the best launch system for server based applications. The best part is that the config files and methodologies are applicable to windows and unix, as well as launching from a command line or for a debugger. They have tomcat examples on their site.

    Posted by: tlaurenzo on September 26, 2003 at 09:09 AM

  • Java Service Wrapper - thanks!
    Fortunately I have just a single Tomcat instance on the box and it's only running a single web application for project news. Thanks for the link though, I'll take a look and keep this in mind.

    Posted by: simongbrown on September 26, 2003 at 09:21 AM

  • Timely
    Too funny. I was just googling yesterday to figure out how to get Tomcat in the JWSDP 1.2 to run as a service and got nowhere. Your command line above doesn't seem to work as noe of the scripts in the JWSP have the install parameter as an option. I've only just started to try Wrapper but the amount of configuration is pretty heavy. At any rate I'm sure that by following the links related to this post I'll have it done soon enough.

    Marc g

    Posted by: goodner on September 26, 2003 at 02:09 PM

  • Duh! warning: Careful with spaces & new lines
    Thanks very much for the above script. This is indeed useful. I have used this for Tomcat 4.06, 4.1.18, and 4.1.27 sucessfully on WinXP.

    For the newbies:
    Make sure if your CATALINA_HOME has spaces in it such as "C:\Program Files\Apache Group" to use the proper quotations in the proper location. Also make sure the above script is, of course, on one line- copy & paste from this page will not work.

    Posted by: freddio on September 30, 2003 at 02:40 PM

  • NT Service Dependencies
    How do I add dependencies to this service? Do I do it in the script or in the services window?

    Posted by: jmwest85 on October 01, 2003 at 09:56 AM

  • NT Service Dependencies
    I'm pretty sure that all service dependencies are setup in the Services window for Win2K and XP. As for NT, I'm not sure.

    Posted by: simongbrown on October 01, 2003 at 11:09 AM

  • Duh! warning: Careful with spaces & new lines
    Yes, it's certainly worth reiterating that I separated the command for clarity! Thanks for your feedback that it works with earlier (4.0) versions of Tomcat.

    Posted by: simongbrown on October 01, 2003 at 11:10 AM

  • NT Services Dependencies?
    I have successfully installed the service using the script, however I cannot set a dependency in the services window. Any ideas where I should do this?

    Thanks

    Posted by: jmwest85 on October 01, 2003 at 01:16 PM

  • NT Services Dependencies?
    You can't actually add service dependencies through the services window - to do that you need to edit the registry. Here's an example for adding a dependency on Microsoft SQL Server to the "Jakarta Tomcat 4" service created by Simon's script above:

    1) Go to Start->Run, type in 'regedt32' then press enter
    2) Navigate down to SYSTEM->CurrentControlSet->Services->Jakarta Tomcat 4
    3) Go to Edit->Add Value
    4a) For Value Name enter: DependOnService
    4b) For Data Type choose: REG_MULTI_SZ
    4c) Click OK
    4d) Enter the name of the service key that you depend on, e.g. 'MSSQLSERVER'
    4e) Click OK
    5) Exit from the registry

    That's it - it should now show up as a dependency if you go to the services window.

    Neil

    Posted by: neilpayne on November 21, 2003 at 06:50 AM

  • Error starting the Tomcat service
    I had installed Tomcat 4.1.1.29 build on Win2k OS without adding the service.

    I have successfully installed the service by using the script, however I cannot run the service. I received the following error message.
    Could not start the Jacarta Tomcat 4.1 service on Local Computer.
    The service did not return an error.
    This could be internal Windows error or internal service error.
    If the problem persists contact your sysadmin.

    When the service is installed during the installation, it starts and stops without any problem.

    Any thoughts, what should I do to run it?

    Thanks..

    Posted by: alexandr on January 21, 2004 at 10:13 AM

  • Error starting the Tomcat service
    I would probably start with double checking the location of the Java and Tomcat installs, then perhaps remove the service and try again. Apart from that I'm not sure what to suggest.

    Posted by: simongbrown on January 21, 2004 at 11:04 AM

  • Error starting the Tomcat service
    It is working now. The jvm.dll was caused the problem. The location of it depends on the version of jdk( jre).
    Thanks a lot for help.

    Posted by: alexandr on January 22, 2004 at 07:27 AM

  • JWSDP as an NT Service
    Has anyone got any hints as to install JWSDP 1.2 as an NT Service ?

    Soren

    Posted by: shc on May 06, 2004 at 07:29 AM

  • JVM
    In your command line, you use
    "%JAVA_HOME%\jre\bin\server\jvm.dll but when I install tomcat using
    "jakarta-tomcat-4.1.29.exe" it uses
    "%JAVA_HOME%\jre\bin\client\jvm.dll
    The Dlls are different. Do you know if this matters?

    Posted by: anndunbar on August 17, 2004 at 01:25 AM

  • Error starting the Tomcat service
    Hi Alex,

    Even I encountered this problem and can suggest you two solutions for the same:
    a) Go to your application instance and deletion all sessions (work\Standalone\localhost\_) and try restarting the services.
    b) Reboot your mac :)
    For now from my part these are the only ways to overcome this proble.

    Regards,
    Jay

    Posted by: jayashankar on September 18, 2004 at 08:03 AM

  • File system considerations: I noticed that after I installed tomcat as a service, my System settings user.dir and others stopped working. Logs are now going to System32! Is there anyway to install tomcat with CATALINA_HOME being the "base" or "execution" directory so I dont have to change my code?

    Posted by: denma2000 on December 18, 2005 at 07:34 AM

  • wow power leveling
    wow powerleveling
    wow power leveling
    wow gold
    wow items
    feelingame.com
    wow tips
    Most Valuable WOW Power Leveling Service
    wow power leveling faq
    cheap wow power leveling
    wow power leveling
    wow powerleveling
    wow power lvl

    Posted by: wowleveling on December 13, 2007 at 01:19 AM

  • 网络营销软件
    网络营销软件
    网络营销软件
    群发软件
    群发软件
    ---
    群发软件
    网络营销软件
    论坛群发软件
    网站排名软件
    群发软件
    推广小助手破解版
    论坛群发软件
    网站排名软件
    群发软件
    网络营销软件
    网站推广软件
    信息群发软件
    论坛群发软件
    信息群发软件
    博客群发软件
    qq群发软件
    邮件群发软件
    博客群建软件
    企业名录搜索软件
    信息群发软件
    邮件群发软件
    论坛群发软件
    博客群发软件
    网站推广软件
    网络营销软件
    全能营销破解版

    Posted by: bininine on December 16, 2007 at 01:15 AM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds