Installing Tomcat 7 as Service on Windows Server 2008

后端 未结 9 1362
無奈伤痛
無奈伤痛 2021-02-07 05:34

I want to install my tomcat v7.0.12 as a service on my Windows 2008 Server. On the tomcat page I found this tutorial. But there isn\'t a service.bat file in my inst

相关标签:
9条回答
  • 2021-02-07 06:13

    You can find the solution here!

    Install the service named 'Tomcat7'

    C:\>Tomcat\bin\service.bat install
    

    There is a 2nd optional parameter that lets you specify the name of the service, as displayed in Windows services.

    Install the service named 'MyTomcatService'

    C:\>Tomcat\bin\service.bat install MyTomcatService
    
    0 讨论(0)
  • 2021-02-07 06:15

    I have spent a couple of hours looking for the magic configuration to get Tomcat 7 running as a service on Windows Server 2008... no luck.

    I do have a solution though.

    My install of Tomcat 7 works just fine if I just jump into a console window and run...

    C:\apache-tomcat-7.0.26\bin\start.bat
    

    At this point another console window pops up and tails the logs (tail meaning show the server logs as they happen).

    SOLUTION

    Run the start.bat file as a Scheduled Task.

    1. Start Menu > Accessories > System Tools > Task Scheduler

    2. In the Actions Window: Create Basic Task...

    3. Name the task something like "Start Tomcat 7" or something that makes sense a year from now.

    4. Click Next >

    5. Trigger should be set to "When the computer starts"

    6. Click Next >

    7. Action should be set to "Start a program"

    8. Click Next >

    9. Program/script: should be set to the location of the startup.bat file.

    10. Click Next >

    11. Click Finish

    12. IF YOUR SERVER IS NOT BEING USED: Reboot your server to test this functionality

    0 讨论(0)
  • 2021-02-07 06:27

    There are a lot of answers here, but many overlook a few points. I ran into the same issue and it was likely due to a combination of being a complete neophyte when it comes to tomcat. Even more I am rather new to web servers in general. I consider myself somewhat proficient user of windows, but I guess not proficient enough. In particular I don't work with services too much.

    I did not have a startup.bat or any bat files. I only downloaded the 32-bit/64-bit Windows Service Installer. The bin that is created for that download is small - only 4 files. My colleagues were surprised that I did not have a catalina.bat etc... and I was too. Only the below four files in the bin. And no %CATALINA_HOME% or %TOMCAT_HOME% etc...

    bootstrap.jar
    tomcat-juli.jar
    Tomcat7.exe
    Tomcat7w.exe
    

    With this setup I had some frustrations as setting parameters is done via the gui widget - very helpful I might add.

    So nearly all the answers I have perused were not immediately applicable as many said, "go to bin and issue the startup.bat file" I am a neophyte but not so much to not be able to look into the bin and start such a file it is existed!

    For my simple purposes (again remember that I am a neophyte at tomcat and even web servers) all I wanted to do was to be able to startup and shutdown the tomcat server from a cmd prompt window. Nothing too heavy duty. I am embarrassed to say how simple it is. It is probably evident to anyone with a shred of experience with services and such.

    To Start server: <Tomcat Root>/bin>Tomcat7.exe start
    To Stop server: <Tomcat Root>/bin>Tomcat7.exe stop
    

    Found here - http://crunchify.com/how-to-start-stop-apache-tomcat-server-via-command-line-setup-as-windows-service/

    I did not realize there was a separate download the 64-bit Windows zip file that has a tomcat server and all the standard array of cmd line tomcat management tools. This zip file has all the common startup/shutdown scripts, batch files for windows, including catalina.bat/.sh etc... Then all the above answers make sense and are rather trivial.

    Remember I am a neophyte when it comes to tomcat and web servers. It appears these two downloads are somewhat mutually exclusive in the sense that if I download and install the 32-bit/64-bit Windows Service Installer version and the 64-bit Windows zip file the startup.bat file in the 64-bit Windows zip file version will not run or interact with the 32-bit/64-bit Windows Service Installer tomcat instance. But I am not sure about this point.

    0 讨论(0)
  • 2021-02-07 06:27

    I had a similar problem, there isn't a service.bat in the zip version of tomcat that I downloaded ages ago.

    I simply downloaded a new 64-bit Windows zip version of tomcat from http://tomcat.apache.org/download-70.cgi and replaced my existing tomcat\bin folder with the one I just downloaded (Remember to keep a backup first!).

    Start command prompt > navigate to the tomcat\bin directory > issue the command:

    service.bat install

    Hope that helps!

    0 讨论(0)
  • 2021-02-07 06:31

    I just had the same issue and could only install tomcat7 as a serivce using the "32-bit/64-bit Windows Service Installer" version of tomcat:

    http://tomcat.apache.org/download-70.cgi

    0 讨论(0)
  • 2021-02-07 06:32

    Looks like now they have the bat in the zip as well

    note that you can use windows sc command to do more

    e.g.

    sc config tomcat7 start= auto
    

    yes the space before auto is NEEDED

    0 讨论(0)
提交回复
热议问题