Search code examples
tomcatcatalina

Wrong server version being displayed when checking tomcat version (version.sh)


Hi all hope you can give some clues. This is driving me insane.

So, when I run version.sh to check which tomcat is running i get the below block.

As you can see under "server version" I get 7.0.64 not 7.0.69. How do I change this? I have another server and it is fine. Just this server is being difficult. lol

Tks,V

[root@blah01 bin]# ./version.sh 
Using CATALINA_BASE:   /opt/apache-tomcat-7.0.69 
Using CATALINA_HOME:   /opt/apache-tomcat-7.0.69 
Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.69/temp 
Using JRE_HOME:        /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el6_10.x86_64/jre 
Using CLASSPATH:       /opt/apache-tomcat-7.0.69/bin/bootstrap.jar:/opt/apache-tomcat-7.0.69/bin/tomcat-juli.jar 
Server version: Apache Tomcat/7.0.64 
Server built:   Aug 19 2015 17:18:06 UTC 
Server number:  7.0.64.0 
OS Name:Linux 
OS Version:     2.6.32-754.3.5.el6.x86_64 
Architecture:   amd64 
JVM Version:    1.8.0_181-b13 
JVM Vendor:     Oracle Corporation

Solution

  • Based upon the output you are getting, I would suspect that this is a simple case of a misguided upgrade (or, in this case, a downgrade).

    The script version.sh (and, on Windows, version.bat) extracts the version number from the compiled Java classes, so this is not a case of a single script that was copied-over a higher-numbered version of Tomcat (or, more likely, a single file that was not "upgraded" along with the rest of Tomcat).

    The solution is to repair your Tomcat installation by removing what you have and re-installing a fresh copy of the desired version.

    I would highly recommend reading the section titled Advanced Configuration - Multiple Tomcat Instances in the RUNNING.txt file that ships with Tomcat. It describes how you can "split" a Tomcat deployment into two directories: one which contains the Tomcat binary files and scripts (called CATALINA_HOME, after the environment variable which controls it) and another one which contains your configuration, (usually) applications, and (sometimes) supporting scripts for that particular instance (called CATALINA_BASE).

    Splitting your environment in two makes it very easy to both upgrade and downgrade. It goes something like this for a single point-release upgrade:

    1. Unpack the new version into apache-tomcat-x.y.z
    2. Copy any custom libraries from /path/to/apache-tomcat-x.y.z-1/lib to /path/to/apache.tomcat-x.y.z/lib
    3. Stop the existing Tomcat instance if it's running
    4. Change CATALINA_BASE from /path/to/apache-tomcat-x.y.z-1 to /path/to/apache.tomcat-x.y.z
    5. Launch the new Tomcat instance (e.g. /path/to/apache.tomcat-x.y.z/bin/catalina.sh start)

    If something goes wrong and you need to downgrade, just change CATALINA_BASE back to the original value and restart your Tomcat instance. You'll be back where you started and you can figure out why the new version wasn't working properly.