- 1 Product Description
- 1.1 Known Versions
- 2 Software Pattern Summary
- 3 Platforms Supported by the Pattern
- 4 Identification
- 5 Versioning
- 5.1 Active Versioning
- 5.1.1 Common Functionality
- 5.1.2 Cross Platform Active Command
- 5.1.3 Unix Active Versioning
- 5.2 Path Versioning
- 5.3 Package Versioning
- 5.4 Alternative Versioning Approach
- 5.4.1 Registry Versioning
- 5.5 Future Considerations
- 6 Application Model Produced by Software Pattern
- 6.1 Product Architecture
- 6.2 JMX attributes
- 6.3 Software Pattern Model
- 6.3.1 SI Depth
- 6.4 Web Application Discovery (Apache Tomcat extended discovery)
- 7 Subject Matter Expertise
- 8 Testing
- 9 Information Sources
- 10 Open Issues
- Discover with BMC ADDM
-
This product can be discovered by any edition of BMC Atrium Discovery and Dependency Mapping. Download our free Community Edition to try it out, or see what else it can discover!
- What is this?
- This is a product information page, containing details of the information that BMC Atrium Discovery gathers about a product and how it is obtained.
- Product Name
- Tomcat
- Publisher Page
- Category
- Release
- TKU 2012-Apr-1
- Change History
- Reports & Attributes
- Publisher Link
- Apache Foundation
Product Description
Apache Tomcat is an Application Server, otherwise known as a Web Container, developed at the Apache Software Foundation (ASF).
Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Sun Microsystems, providing an environment for Java code to run in cooperation with a web server, in addition it adds tools for configuration and management, which can also be configured by editing configuration files that are normally XML-formatted, and includes its own internal HTTP server.
Known Versions
- 3.2
- 3.3
- 4.1
- 5.0
- 5.5
- 6.0
- 7.0
Software Pattern Summary
| Product Component | OS Type | Versioning | Pattern Depth |
|---|---|---|---|
| Tomcat | Unix | Active, Path, Package | Deep |
| Windows |
Platforms Supported by the Pattern
The current pattern identifies an instance of Apache Tomcat Application Server running on both Unix/Linux and Microsoft Windows platforms.
Identification
Software Instance Triggers
| Trigger Node | Attribute | Condition | Argument |
|---|---|---|---|
| DiscoveredProcess | cmd | matches | regex'\bjava([w]?\.exe)?$' |
| or | |||
| regex'(^|/)jsvc' | |||
| args | regex'org\.apache\.catalina\.startup\.(?:Bootstrap|Tomcat|Main)' | ||
| or | |||
| cmd | matches | regex'(?i)\btomcat[1-9]?\.exe$' | |
| or | |||
| regex'(?i)\btomcatservice\.exe$' | |||
| or | |||
| regex'(?i)\bjk_nt_service\.exe$' | |||
The pattern will stop immediately if it encounters '-Dcom.sun.web.console.base' in the trigger process command line arguments indicating it has triggers off the Tomcat component within Sun Java Web Console.
Simple Identification Mappings
The following components/processes are identified using the combination of pattern definitions and simple identity mappings which map other known (but deemed less important in terms of application modeling) processes. For further details on the processes treated as primes, see Section Application Model Produced by Software Pattern.
| Name | Command |
|---|---|
| Apache Tomcat Servlet Engine | regex'\bjava([w]?\.exe)?$', regex '^.*org\.apache\.catalina\.startup\.Bootstrap' |
| regex'\bjava([w]?\.exe)?$', regex '^.*org\.apache\.tomcat\.startup\.Tomcat' | |
| regex'\bjava([w]?\.exe)?$', regex '^.*org\.apache\.tomcat\.startup\.Main' | |
| regex'(^|/)jsvc', regex'(^|/)jsvc', regex '^.*org\.apache\.catalina\.startup\.Bootstrap' | |
| regex'(^|/)jsvc', regex'(^|/)jsvc', regex '^.*org\.apache\.tomcat\.startup\.Tomcat' | |
| regex'(^|/)jsvc', regex'(^|/)jsvc', regex '^.*org\.apache\.tomcat\.startup\.Main' | |
| regex'(?i)\btomcat[1-9]?\.exe$' | |
| regex'(?i)\btomcatservice\.exe$' | |
| Jakarta NT Service Wrapper for Tomcat | regex'(?i)\bjk_nt_service\.exe$' |
| Apache Tomcat Service Manager (Windows) | regex'(?i)\btomcat[4-9]w\.exe$' |
Versioning
Version information for the product is currently collected using one of three possible methods. We execute the methods in order based on their accuracy, depth and reliability.
Active Versioning
We have been able to identify two methods to actively version this product. The first provides a good level of reliability on all platforms, while the second is Unix only and may be successful on those platforms where the first method fails.
Common Functionality
Obtaining the arguments
The first step for both active versioning techniques is to try to identify the base installation directory. This is obtained by parsing the JAVA arguments. On UNIX these arguments can be obtained by looking at the trigger process arguments. For Windows the method of obtaining the arguments is more complicated and only attempted for Atrium Discovery version 8.1 and above
On Windows, the arguments of the Tomcat process are not included in the trigger process and must be obtained from the registry.
The pattern looks in the registry for all sub directories of HKEY_LOCAL_MACHINE\\SOFTWARE\\Apache Software Foundation\\Procrun 2.0 . If it can find a registry key of the form:
- HKEY_LOCAL_MACHINE\\SOFTWARE\\Apache Software Foundation\\Procrun 2.0\\<directory name>\\Paramaters\\Log\\Path
then the pattern will take the java arguments to be
- HKEY_LOCAL_MACHINE\\SOFTWARE\\Apache Software Foundation\\Procrun 2.0\\<directory name>\\Paramaters\\Java\\Options
If several registry keys match the first entry is used
Parsing the arguments.
The pattern attempts to obtain the following attributes from the JAVA arguments
- Catalina_base, using regular expression: (?i)\-Dcatalina\.base="?(.+?)"?\s+"?-D
- Catalina_home, using regular expression: (?i)\-Dcatalina\.home="?(.+?)"?\s+"?-D
- Classpath, using regular expression: (?i)\s(?:-classpath|-cp) \"(.+?)\"\s
- Alternative classpath regular expression: (?i)\s(?:-classpath|-cp) ([^ ]+)
Cross Platform Active Command
The cross platform active version method is to try and access the release notes of the identified Tomcat process.
If we have been able to extract the "catalina.base" directory from the processes arguments then we use the value found in the argument as the base directory. From there we attempt to open the RELEASE-NOTES.txt file that can be found in the webapps/ROOT directory.
| Windows File: | %catalina_base%\webapps\ROOT\RELEASE-NOTES.txt |
|---|---|
| Unix File: | %catalina_base%/webapps/ROOT/RELEASE-NOTES.txt |
Once we have opened the file we then parse the content against a regex to extract the version information.
| File Regex: | (?i)Apache Tomcat Version\s+(\d(?:\.\d+)*) |
|---|
We have found that this approach provides a version number upto 4 levels of depth.
Unix Active Versioning
The Unix specific version command requires knowing the installation directory of the Java VM running Tomcat, and we acquire this information using one of two methods.
First we try to extract the information by parsing the ouput of the 'env' command for JAVA_HOME environment variable.
| Executed Command: | env | grep JAVA_HOME |
|---|
The output is parsed using the following regular expression:
| Regex: | "JAVA_HOME=(\S+)" |
|---|
If we were unable to extract the JAVA_HOME value from the Environment then we will try to extract the installation path from the Tomcat process command line, if it is a standard java binary (i.e. not being run as java service).
Once we have acquired a valid value we will execute a script found in the Tomcat installation path with an argument value of 'version':
| Executed Command: | JAVA_HOME="%java_home%"; export JAVA_HOME; %catalina_home%/bin/catalina.sh version; unset JAVA_HOME |
|---|
From the returned command we then extract the version number using the following regular expressions in order of preference:
| cmd Regex: | Server number:\s*(\d+(?:\.\d+)*) |
|---|---|
| cmd Regex: | [vV]ersion:\s*Apache Tomcat/(\d+(?:\.\d+)*) |
This approach usually returns a version between 3 to 4 levels of depth.
Path Versioning
If we are unable to acquire the version by using an active versioning method we will attempt to parse the process's command line to see if we can identify any installation patterns.
First we concatenate the process's command into a single value. This allows us to achieve a greater level of success as the process cmd may not contain a path.
The following regular expression is then applied to this path:
| regex: | (?i)tomcat[-/_ ]?(\d(?:[_\-\.]\d+)+) |
|---|
If the version is not obtained, an alternative regular expression is tried:
| regex: | (?i)tomcat(\d(?:[_\-\.]\d+)*) |
|---|
If we acquire a version from the path then we normalise it to ensure that all versions are returned in a common format.
Path versioning usually returns a version between 2 to 4 levels of depth.
Package Versioning
If we are unable to extract the version information from either the Active Command or Path regex then we will attempt to query the package management system to identify a specific version.
We supply the package query with a set of regex's to be checked for.
Regex List
- tomcat$
- tomcat\d+$
This usually returns a version between 3 to 4 levels of depth.
Though this method is often successful it is no specific to an installation, and this may result in the version information for a Tomcat installation being inaccurate if there are multiple installations on the host.
Alternative Versioning Approach
Registry Versioning
From version 5.0 onwards Apache Tomcat on Windows has had information stored in the Registry. We have identified the following registry keys that returns the information:
Registry Keys
- HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Tomcat\5.0\Version
- HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Tomcat\5.5\version
- HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Tomcat\6.0\version
Risks
- Product version obtained by reading the registry is only used if no other method succeeds. i.e. if a matcher implements multiple versioning methods, and more than one succeeds, Registry versioning has the lowest precedence and may therefore be ignored
- Product version can be obtained through Registry only for Tomcat 5.0 and above - thus, if path regex versioning is completely replaced with Registry-based method, while depth of versions obtained is likely to increase, the overall coverage may decrease
- Tomcat is often bundled with other applications. This may lead to more than one instance of Tomcat being installed and running on a host. At present, there is no way to directly link the detected process with a value obtained from the Registry. This may lead to false positives.
It is our conclusion that this versioning approach could be used but only once an understanding of the customer environment exists and where the risks listed above have been evaluated and found to be low.
Due to these risks we have not included it in the versioning techniques in the pattern. In the future it would be a consideration.
Future Considerations
An additional Windows versioning technique that can be used is the Registry query. Once we are able to execute this query in a more controlled manner then we will add it to the pattern.
Application Model Produced by Software Pattern
Product Architecture
Tomcat Application server is a container for other application to be run in. It allows for the running of J2EE applications in a controlled web based environment.
As such it sits on top of a webserver and processes requests from the user to the Java application that is being hosted. From an external view there is no visibility of what application Tomcat is hosting, where this application resides or what its purpose is - all you see is Tomcat running on a host.
There is no indication that this product forks, has multiple threads or creates any child processes.
JMX attributes
Various JMX attributes are obtained by the pattern. This is only attempted for Atrium Discovery version 8.1 and above. The attributes are obtained by parsing the JAVA arguments using the following regular expressions:
| Attribute | Regular expression |
|---|---|
| jmx_enabled | True iff -Dcom\.sun\.management\.jmxremote exists |
| jmx_port | -Dcom.sun.management.jmxremote.port=(\d+) |
| jmx_ssl | -Dcom\.sun\.management\.jmxremote\.ssl=(\w+) |
| jmx_authenticate | -Dcom\.sun\.management\.jmxremote\.authenticate=(\w+) |
| jmx_ssl_need_client_auth | -Dcom\.sun\.management\.jmxremote\.ssl\.need\.client\.auth=(\w+) |
Software Pattern Model
The pattern triggers on any of the many forms that Tomcat can be run in, either on one of the specific binaries or java/class combinations. Once triggered we are sure that the process is a valid running Tomcat installation.
SI Depth
If catalina base has been discovered an instance based Software Instance is created, with a key based on catalina base, type and host key
If catalina home has been discovered a grouped Software Instance is created, with a key based on catalina home, type and host key
In all other cases a grouped Software Instance is created, with key based on trigger process, JAVA classpath, type and host key
Web Application Discovery (Apache Tomcat extended discovery)
Apache Tomcat web applications discovery is described in detail in our main documentation for Atrium Discovery 8.2 and Atrium Discovery 8.3
Subject Matter Expertise
We have received SME input with regards the Active Versioning technique. It identified the Release Notes text file containing version information in the installation directory of the product.
Any further SME input would be welcome on any other potential approaches to improving Tomcat versioning coverage and depth or with regards identifying the applications running on a particular installation.
Testing
Testing to ensure the processes related to Apache Tomcat Server have been correctly identified has been performed using Foundation record data as well as live discovery of hosts running Solaris, Linux and Windows operating systems.
Both live discovery and record data contained enough information to extract the version information using the path regular expression methods.
Information Sources
Tomcat Wikipedia was used to gather information on the product and produced a lot of the product description. It was also used as the source for some of our known versions.
The official Apache Tomcat homepage was used to identify some versioning techniques and completed the information we had on known versions.
Open Issues
There are no outstanding issues with this pattern.
| TOP |
|---|
Created by: Chris Blake 08 Feb 2010
Updated by: Nikola Vukovljak 22 Apr 2012
