How to start and stop Tomcat

Home > Search > How-to
  by

To start Tomcat, run the startup script.

~]# $CATALINA_HOME/bin/startup.sh
. . .
Tomcat started.

 

To stop Tomcat, run the shutdown script.

~]# $CATALINA_HOME/bin/shutdown.sh

 

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:<port number>. The Tomcat home page should be displayed.

 

The ps command can be used to verify that Tomcat is running. If the ps command displays two or more processes, where one of the process is Java, this 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 . . .

 

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]

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




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




Comments