Bootstrap FreeKB - Tomcat - Starting Stopping and Restarting Tomcat
Tomcat - Starting Stopping and Restarting Tomcat

Updated:   |  Tomcat articles

The startup.sh script (on a Linux system) is used to start Tomcat. This script uses Java to start Tomcat, which makes sense, since Tomcat is used to run Java apps via Java Virtual Machines (JVMs).

~]# <base Tomcat installation directory>/bin/startup.sh
Tomcat started.

 

The <base Tomcat installation directory>/logs/catalina.out file should contain this event to know if Tomcat has started.

17-Sep-2017 17:45:17.371 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]

 

The ps command can be used to determine if Tomcat is running. If the ps command returns a Java process, this usually means Tomcat is running.

~]# ps -ef | grep tomcat
root  13044 12965  0  17:37  pts/0  00:00:00  grep --color=auto  tomcat
root  18695     1  0  Sep08  ?      00:03:00  /usr/bin/java . . .

 

The catalina.out file will display Tomcat's listening ports. These ports are obtained by reading the server.xml file. In this example, Tomcat is using port 8080 for HTTP, port 8443 for HTTPS, and port 8009 for AJP.

~]# cat $CATALINA_HOME/logs/catalina.out
17-Sep-2017 17:45:17.371 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
17-Sep-2017 17:45:17.641 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["https-jsse-nio-8443"]
17-Sep-2017 17:45:17.761 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]

 

Navigate to http://www.example.com:8080 or https://www.example.com:8443. The Tomcat home page should be displayed.

 

Sometimes, after Tomcat has started, it can take some time for the web apps to be deployed. The catalina.out file can be checked to see if there is a delay in the deployment of the web apps.

~]# cat $CATALINA_HOME/logs/catalina.out
17-Sep-2017 17:45:17.914 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/ROOT]

 


The shutdown.sh script (on a Linux system) is used to stop Tomcat.

<base Tomcat installation directory>/bin/shutdown.sh

 

These events will be recorded in the catalina.log.

Jun 03, 2018 3:40:25 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-nio-8080"]

Jun 03, 2018 3:40:25 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina

Jun 03, 2018 3:40:25 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-nio-8080"]

Jun 03, 2018 3:40:25 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-nio-8080"]

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 8b1568 in the box below so that we can be sure you are a human.