Skip to content

How to Check Apache Tomcat Version: 7 Methods Explained

Purpose

I needed to verify which version of Apache Tomcat was running on my server before applying a security patch. This seems like a simple task, but I discovered there are multiple ways to check it, each useful in different scenarios.

This post demonstrates 7 different methods to check your Apache Tomcat version.

Environment

  • Apache Tomcat 10.1.52
  • Debian 12 (Linux)
  • Java 17

Method 1: Using the version.sh Script

The quickest method is using the built-in script that comes with Tomcat:

Check Tomcat version
$ cd /opt/tomcat
$ ./bin/version.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Server version: Apache Tomcat/10.1.52
Server built: Jan 16 2025 12:34:56 UTC
Server number: 10.1.52.0
OS Name: Linux
OS Version: 6.1.0-17-amd64
Architecture: amd64
JVM Version: 17.0.13+11-Debian-1deb12u1
JVM Vendor: Debian

This method works even when Tomcat is not running, which I found very useful.

If you only want the version line, pipe it through grep:

Extract version only
$ ./bin/version.sh | grep "Server version"
Server version: Apache Tomcat/10.1.52

Method 2: Using catalina.sh version

The catalina.sh script has a version command that does the same thing:

Using catalina.sh
$ ./bin/catalina.sh version
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Server version: Apache Tomcat/10.1.52
Server built: Jan 16 2025 12:34:56 UTC
Server number: 10.1.52.0
OS Name: Linux
OS Version: 6.1.0-17-amd64
Architecture: amd64
JVM Version: 17.0.13+11-Debian-1deb12u1
JVM Vendor: Debian

Method 3: Web Interface

If Tomcat is running and you have browser access, navigate to:

http://localhost:8080

The page title shows the version. You can also check with curl:

Check via HTTP
$ curl -s http://localhost:8080 | grep title
<title>Apache Tomcat/10.1.52</title>

This method works for remote servers too - just replace localhost with the server IP address.

Method 4: Using catalina.jar with ServerInfo Class

I found another method that directly queries the ServerInfo class:

Using java -cp to query ServerInfo
$ java -cp ./lib/catalina.jar org.apache.catalina.util.ServerInfo
Server version: Apache Tomcat/10.1.52
Server built: Jan 16 2025 12:34:56 UTC
Server number: 10.1.52.0
OS Name: Linux
OS Version: 6.1.0-17-amd64
Architecture: amd64
JVM Version: 17.0.13+11-Debian-1deb12u1
JVM Vendor: Debian

This method also works without starting Tomcat.

Method 5: Check the RELEASE-NOTES File

Every Tomcat installation includes a RELEASE-NOTES file:

Read RELEASE-NOTES
$ grep "Apache Tomcat Version" ./RELEASE-NOTES
Apache Tomcat Version 10.1.52

Or check the first few lines:

Head of RELEASE-NOTES
$ head -5 ./RELEASE-NOTES
Apache Tomcat Version 10.1.52
Release Notes
$Id: RELEASE-NOTES.txt $
================================================================================

This is useful when you have file system access but cannot run scripts.

Method 6: Check Log Files

Tomcat logs the version information every time it starts. Check the catalina.out log:

Check startup logs
$ grep "Starting Servlet engine" ./logs/catalina.out | tail -1
INFO [main] org.apache.catalina.startup.Catalina.start Starting Servlet engine: [Apache Tomcat/10.1.52]

This method is helpful when:

  • Tomcat is currently stopped
  • You want to verify what version was last running
  • You have limited permissions to run scripts

Method 7: Programmatically via Java

If you need to check the version from within your application code, you have a few options:

Option 1: Using ServerInfo class

ServerInfoExample.java
import org.apache.catalina.util.ServerInfo;
public class ServerInfoExample {
public static void main(String[] args) {
System.out.println("Server Info: " + ServerInfo.getServerInfo());
System.out.println("Server Version: " + ServerInfo.getServerNumber());
System.out.println("Server Built: " + ServerInfo.getServerBuilt());
}
}

Option 2: Using ServletContext

ServletContextExample.java
import jakarta.servlet.ServletContext;
public class VersionServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) {
ServletContext context = getServletContext();
String serverInfo = context.getServerInfo();
response.getWriter().println("Server Info: " + serverInfo);
}
}

The output would be:

Server Info: Apache Tomcat/10.1.52

Which Method Should You Use?

Here’s my recommendation based on the situation:

+------------------------+----------------------+
| Scenario | Best Method |
+------------------------+----------------------+
| Local server, CLI | version.sh |
| Remote server | curl + HTTP |
| Server stopped | RELEASE-NOTES file |
| Application code | ServletContext API |
| No script permissions | Log files |
| Quick local check | Web interface |
+------------------------+----------------------+

Summary

In this post, I showed 7 different methods to check Apache Tomcat version:

  1. version.sh script - The most reliable CLI method
  2. catalina.sh version - Alternative CLI method
  3. Web interface - Quick visual check via browser or curl
  4. catalina.jar ServerInfo - Java class query
  5. RELEASE-NOTES file - Simple file read
  6. Log files - Check historical version info
  7. Programmatic - For application integration

The quickest method is running ./bin/version.sh from your Tomcat installation directory. Choose the method that fits your access level and server state - CLI scripts for local access, web interface for quick checks, and file-based methods when the server is stopped.

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments