Skip to content

Posts tagged ‘tomcat liferay upgrade’

Liferay Enterprise Tomcat 6 Upgrade for Linux

We recently ran into an issue with our Liferay Enterprise install where the version of Tomcat they had bundled in was falling behind security wise. Currently Tomcat 6.0.29 is available and their bundle is currently holding fast at 6.0.18. When we first set out to install Liferay for use with some internet applications, it was my original intent to start off with a separate installation of Tomcat that we maintain and install the Liferay components on top of that. The consultant that was working with us strongly discouraged that so despite my gut feeling I made the mistake of giving in to the our customer’s demands to get the project underway and installed the bundle. Liferay is pretty well integrated with the various bundles that they support so this is not just a simple drop in and replace upgrade of Tomcat. Word from another department integrating it with JBOSS encountered a similar struggle.

At some point in time, if you began using the bundle, you should have unzipped/untar’d it to a given location, for our servers we used /opt. For simplicity sake, I will just state that liferay is rolled out to a directory called “liferay” beneath /opt. Your directory may be “liferay-portal-5.2.3-ee-sp4″ or something to that effect. Beneath /opt/liferay, you should have 4 directories, “deploy”, “ee”, “data” and the tomcat directory encoded by default with the specific version number that was bundled with your install.  For the purposes of this update will refer your current directory of the bundled Tomcat install $TOMCAT-OLD and the one you want to upgrade to $TOMCAT-NEW.

Download the latest version of Tomcat 6 here: http://tomcat.apache.org/download-60.cgi

Stop the current running version of Liferay/Tomcat.

Unzip apache-$TOMCAT-NEW to the same directory as your Liferay bundle “/opt/liferay” then rename to the same naming convention (removing “apache-”).

Edit $TOMCAT-NEW/conf/catalina.properties
Search for the line:

common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar

Replace the line with this:

common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/lib/ext/*.jar

Edit $TOMCAT-NEW/conf/server.xml
change each instance of

redirectPort="8443" />

to

redirectPort="8443" URIEncoding="UTF-8" />

(three instances, one of which is commented out)

Copy setenv.sh from $TOMCAT-OLD/bin to $TOMCAT-NEW/bin

Delete all contents of $TOMCAT-NEW/webapps

Copy the contents of $TOMCAT-OLD/webapps to $TOMCAT-NEW/webapps

Create directory $TOMCAT-NEW/lib/ext

Copy the contents of $TOMCAT-OLD/lib/ext to $TOMCAT-NEW/lib/ext

Create directory $TOMCAT-NEW/conf/catalina/localhost

Copy the contents of $TOMCAT-OLD/conf/catalina/localhost to $TOMCAT-NEW/conf/catalina/localhost

Review the $TOMCAT-OLD/bin/catalina.sh, you may have custom environmental variables. This is a sample chunk of what gets moved to $TOMCAT-NEW/bin/catalina.sh

CATALINA_HOME=/opt/liferay/$TOMCAT-NEW/tomcat-6.0.29/  
 export CATALINA_HOME  
 PATH=/usr/java/jdk1.6.0_18/bin:$PATH  
 export PATH  
 JAVA_HOME=/usr/java/jdk1.6.0_18  
 export JAVA_HOME

and append with

CATALINA_BASE=/opt/liferay/$TOMCAT-NEW/  
 export CATALINA_BASE

(Be sure to make sure all instances of $TOMCAT-OLD have been replaced with $TOMCAT-NEW).

Test the new install of tomcat by running

/opt/liferay/$TOMCAT-NEW/bin/catalina.sh

If you are starting Tomcat automatically, copy the new catalina.sh over to /etc/init.d/ and the existing symlinks from the proper run levels will be updated as well.

If you have any issues with this process, please feel free to comment below.

1 Sep 2010