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:
$ cd /opt/tomcat$ ./bin/version.shUsing CATALINA_BASE: /opt/tomcatUsing CATALINA_HOME: /opt/tomcatUsing CATALINA_TMPDIR: /opt/tomcat/tempUsing JRE_HOME: /usrUsing CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jarUsing CATALINA_OPTS:Server version: Apache Tomcat/10.1.52Server built: Jan 16 2025 12:34:56 UTCServer number: 10.1.52.0OS Name: LinuxOS Version: 6.1.0-17-amd64Architecture: amd64JVM Version: 17.0.13+11-Debian-1deb12u1JVM Vendor: DebianThis method works even when Tomcat is not running, which I found very useful.
If you only want the version line, pipe it through grep:
$ ./bin/version.sh | grep "Server version"Server version: Apache Tomcat/10.1.52Method 2: Using catalina.sh version
The catalina.sh script has a version command that does the same thing:
$ ./bin/catalina.sh versionUsing CATALINA_BASE: /opt/tomcatUsing CATALINA_HOME: /opt/tomcatUsing CATALINA_TMPDIR: /opt/tomcat/tempUsing JRE_HOME: /usrUsing CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jarUsing CATALINA_OPTS:Server version: Apache Tomcat/10.1.52Server built: Jan 16 2025 12:34:56 UTCServer number: 10.1.52.0OS Name: LinuxOS Version: 6.1.0-17-amd64Architecture: amd64JVM Version: 17.0.13+11-Debian-1deb12u1JVM Vendor: DebianMethod 3: Web Interface
If Tomcat is running and you have browser access, navigate to:
http://localhost:8080The page title shows the version. You can also check with curl:
$ 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:
$ java -cp ./lib/catalina.jar org.apache.catalina.util.ServerInfoServer version: Apache Tomcat/10.1.52Server built: Jan 16 2025 12:34:56 UTCServer number: 10.1.52.0OS Name: LinuxOS Version: 6.1.0-17-amd64Architecture: amd64JVM Version: 17.0.13+11-Debian-1deb12u1JVM Vendor: DebianThis method also works without starting Tomcat.
Method 5: Check the RELEASE-NOTES File
Every Tomcat installation includes a RELEASE-NOTES file:
$ grep "Apache Tomcat Version" ./RELEASE-NOTESApache Tomcat Version 10.1.52Or check the first few lines:
$ head -5 ./RELEASE-NOTESApache Tomcat Version 10.1.52Release 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:
$ grep "Starting Servlet engine" ./logs/catalina.out | tail -1INFO [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
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
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.52Which 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:
- version.sh script - The most reliable CLI method
- catalina.sh version - Alternative CLI method
- Web interface - Quick visual check via browser or curl
- catalina.jar ServerInfo - Java class query
- RELEASE-NOTES file - Simple file read
- Log files - Check historical version info
- 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:
- π¨βπ» Apache Tomcat Documentation
- π¨βπ» Apache Tomcat Version Sh Script
- π¨βπ» Tomcat ServerInfo API
Oh, and if you found these resources useful, donβt forget to support me by starring the repo on GitHub!
Comments