Friday, October 28, 2011

Issues with Tomcat 5.0 Start/Restart


Tomcat 5.0  Start/Restart
Problem Statement :  This document describes features and drawbacks of various options of Starting/Restarting Tomcat Webserver.
We can Start/Restart the Tomcat Web server in the following two ways. 
1)      Through the services.msc,
2)    Through the startup.bat
Through the services.msc :-
Features :-
1)      It’s a GUI interface.  So, performing Tomcat Start/Stop/Restart operations are very easy.
2)    This process is going on background.  So, it won’t open another window.
3)    Tomcat Service progress information automatically redirects to logs directory’s stdout.log file.  So, at any time, we can review the service status. 
Note:- Tomcat overrides stdout.log file on Service Start-up.  If you want previous information, then you need to take backup.  This file also gives clear information on Tomcat Startup failures.
4)    We need not worry in case of Windows’ user logoff/restart the system.  It means, this process works with any user and starts automatically as a windows background service while windows Start/Restart.
Drawbacks :-
5)    But, only one problem with this feature, i.e., services.msc is also an application.  It starts from C:\WINNT\system32 directory.  So, by default, this application is pointing to this directory.  So, we need to place application dependent files (like properties files) into this directory.
6)    We should specify the path environment variables for JAVA_HOME and CATALINA_HOME.


Through the startup.bat :-
Drawbacks :-
1)      This is command-line application.  There are different batch files for Start/Shutdown the Tomcat Web Server.  To Restart the Tomcat Web Server, we have to do Shutdown and Start.
2)    This process opens a new console window.  This window is very sensitive.  We should not close it.  If we close this window, Tomcat gets shutdown automatically.  And also, we should not click on this window.  If you left-click on this window, Tomcat stops the service temporarily.  Then, all applications that are working on this web server gets hang.  Then, applications won’t work.
3)    This window displays progress information about Tomcat Service.  But, this information scrolls out of the screen after some time.  We can’t get it back and not possible to take backup.
4)    We should take care in case of Windows’ user logoff/restart the system.  In this case, Windows closes this window automatically.  We need to restart the tomcat again.
Features :-
5)    This batch file runs from <TOMCAT_HOME>/BIN directory.  We need to place application dependent files (like properties files) into this directory.
6)    The only one main advantage is, this start-up batch file sets JAVA_HOME and CATALINA_HOME path settings automatically for that instant.

Conclusion:- Start/Restart the Tomcat Web Server through services.msc is the best way.  But, we need to take care of dependent files as specified in   case 4.