I have been using Tomcat as a web container for a significant ti开发者_StackOverflow中文版me period but I never come across a situation to use Tomcat as a Windows Service. So far I was thinking why Tomcat implementors provide a facility to run tomcat as Window Service.
What are the advantages we get by using Tomcat as a Windows Service rather than using
startup.bat
andshutdown.bat
on the command line?Is it really used in production environment?
Q1: You don't need to login into an active user session. Your server is up when the machine is up. You do not accidently stop the service by quitting a front process.
Q2: yes, on Windows Server products for shure.
If Tomcat is running as a service, you can ensure it restarts if the machine reboots unexpectedly for any reason; you can take actions if the service crashes; and you can run the service as a specified user fairly simply. If you run from the command line, you have none of these options.
Running Tomcat as a service that starts itself automatically on boot is the preferred way to run an application server in any environment: windows, Linux, unix.
The reason? You won't have to login to start application server manually if it is something that needs to be running all the time. As application servers usually do.
what are the advantage we can get by using Tomcat as a Windows Service?
You can set the service to start automatically when the PC is turned on. This is useful for servers where you want Tomcat to start again after a reboot or crash.
Does it really use in production environment ?
Yes, we always use that setting when we have to set up Windows servers.
On development machines, some people use it because it's convenient to start/stop Tomcat from the sys tray.
精彩评论