Leave a comment at the end of this page or email contact@krishagni.com
How to upgrade Tomcat?
In this document, $TOMCAT_HOME is used to refer to the absolute path of the directory containing the working Tomcat server, and $WORK_DIR is used to refer to the directory you prefer to work in.
Steps to upgrade Tomcat
1. Unzip the new downloaded Tomcat9.zip archive into the $WORK_DIR
$ cp Tomcat9x.zip $WORK_DIR
$ cd WORK_DIR
$ unzip Tomcat9x.zip
2. Change directory to new Tomcat conf.
$ cd tomcat-as/conf
3. Edit the new context.xml file and configure the database connection pool by referring to the working context.xml and save the file.
$ vi context.xml
4. Edit the new server.xml file and configure the Tomcat ports by referring to the working server.xml file and save the file.
$ vi server.xml
5. Copy the openspecimen.properties from working tomcat-as/conf/ directory to new tomcat-as/conf directory.
$ cp $TOMCAT_HOME/tomcat-as/conf/openspecimen.properties $WORK_DIR/tomcat-as/conf/.
6. Copy the openspecimen.war file from working tomcat-as/webapps/ directory to new tomcat-as/conf directory.
$ cp $TOMCAT_HOME/tomcat-as/webapps/openspecimen.war $WORK_DIR/tomcat-as/webapps/
7. Rename the working Tomcat directory to old_tomcat-as and compress that directory.
$ cd $TOMCAT_HOME
$ mv tomcat-as old_tomcat-as
$ zip -r old_tomcat-as.zip old_tomcat-as
8. Copy the new tomcat-as directory from OpenSpecimen build to the current Tomcat directory path.
$ cp -r $WORK_DIR/tomcat-as $TOMCAT_HOME
8. configure the Tomcat to run as a service.
Please refer to this Wiki page.
Additional Configuration (Tomcat 9.0.91 onwards)
For Ubuntu/Linux:
Open the
catalina.shfile located at/usr/local/tomcat-as/bin/catalina.sh.Search for the comment line:
# Add the JAVA 9 specific start-up parameters required by TomcatAdd the following line below that comment:
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.net=ALL-UNNAMED"Add the attribute
notFoundClassResourceCacheSize="0"to the<Context>tag at the top of the file.
Example:<Context notFoundClassResourceCacheSize="0">
For Windows:
Open the
context.xmlfile in the new Tomcat'sconffolder.Add the attribute
notFoundClassResourceCacheSize="0"to the<Context>tag at the top of the file.
Example:<Context notFoundClassResourceCacheSize="0">Open the
service.batfile in thebinfolder using Notepad++ or another text editor.Find the
--JvmOptions9section and add:
--add-opens=java.base/java.net=ALL-UNNAMED#
Note:
Before following the above steps, please make sure Tomcat is not in a running state.
Leave a comment at the end of this page or email contact@krishagni.com