Common Issues on Running Tomcat

This section provides some examples of issues on running Apache Tomcat on Linux systems.

Here are some examples of issues on running Apache Tomcat server:

1. One common issue is the default port number 8080 being used by another application. In this case, the "startup.sh" is not showing any error to you. But your Web browser will fail to connect:

herong$ $TOMCAT_HOME/logs/startup.sh
...
Tomcat started.

$herong$ curl http://localhost:8080 
curl: (7) Failed to connect to localhost port 8080 after 0 ms: ...

You only find the root cause of the issue, "Address already in use", from the log file:

herong$ tail -100 $TOMCAT_HOME/logs/catalina.out

...
INFO [main] org.apache.coyote.AbstractProtocol.init	
  Initializing ProtocolHandler ["http-nio-8080"]
SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException 
  Failed to initialize component [Connector["http-nio-8080"]]
  org.apache.catalina.LifecycleException: Failed to initialize component
    ...
  Caused by: java.net.BindException: Address already in use

Resolving this issue is easy. You can stop the other application that uses port 8080. Or you can change Tomcat configuration to use a different port like 8888.

herong$ sudo vi $TOMCAT_HOME/conf/server.xml 

...
<Connector port="8888" protocol="HTTP/1.1"
            ...
           />
...

Restart Tomcat and check the log file:

herong$ $TOMCAT_HOME/logs/shutdown.sh

herong$ $TOMCAT_HOME/logs/startup.sh

herong$ tail -100 $TOMCAT_HOME/logs/catalina.out
(No more SEVERE messages)

2. Another common issue is the default port 8080 being blocked by the firewall. In this case, your Web browser on a remote computer will get the "can't connect to the server" error.

Check the firewall on the server to list ports and services that are open:

herong$ sudo firewall-cmd --zone=public --list-all

public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eno1
  services: cockpit dhcpv6-client mountd nfs rpc-bind ssh
  ports: 80/tcp

Open the firewall for port 8080.

herong$ sudo firewall-cmd --zone=public --add-port=8080/tcp
herong$ sudo firewall-cmd --runtime-to-permanent

Table of Contents

 About This Book

 Introduction to Linux Systems

 Process Management

 Files and Directories

 Running Apache HTTP Server (httpd) on Linux Systems

Running Apache Tomcat on Linux Systems

 What Is Apache Tomcat

 Install Apache Tomcat on Linux

 Start/Stop Apache Tomcat

Common Issues on Running Tomcat

 Turn on SSL/TLS Support on Tomcat

 SSL/TLS Support on Tomcat 8 or Older

 Running PHP Scripts on Linux Systems

 Running MySQL Database Server on Linux Systems

 Running Python Scripts on Linux Systems

 Conda - Environment and Package Manager

 GCC - C/C++ Compiler

 OpenJDK - Open-Source JDK

 Graphics Environments on Linux

 SquirrelMail - Webmail in PHP

 Tools and Utilities

 References

 Full Version in PDF/EPUB