In my previous blog, I shared how to install liferay on existing tomcat using liferay source code. You can found my previous blog here http://helicaltech.com/install-liferay-existing-tomcat-7/

This blog will be talking about how to install liferay on Tomcat using WAR (existing Tomcat)

For this Section, I will refer to your tomcat’s installation folder as $TOMCAT_HOME. Before you begin, make sure that you have downloaded Liferay latest war file. If you haven’t downloaded, you can download from http://www.liferay.com/downloads/liferay-portal/additional-files (Find “Download Wars” section And portal dependencies files from “Dependencies” section).

After downloading, you will get a liferay-portal-6.1.x-<date>.war and liferay-portal-dependencies-6.1.x-<date>.zip.

If you have liferay in your machine, you don’t need to download liferay-portal-dependencies. You can use same Liferay global library as your portal-dependencies files.

Follow these steps, to install Liferay war in Tomcat:

Step-1

Create folder $TOMCAT_HOME/lib/ext.

Step-2

Extract the Liferay dependencies file to $TOMCAT_HOME/lib/ext.

The best way to get the appropriate versions of these files is, If you have liferay in your machine, then copy all .jar from $LIFERAY_HOME/lib/ext to $TOMCAT_HOME/lib/ext  (If you are going through this step, ignore Step-3 and Step-4)

or

Download the Liferay source code and get them from there. Once you have downloaded the Liferay source, unzip the source into a temporary folder and Copy the following jars from $LIFERAY_SOURCE/lib/development to $TOMCAT_HOME/lib/ext

activation.jar

jms.jar

jta.jar

jutf7.jar

mail.jar

persistence.jar

resin.jar

script-10.jar

 

Step-3

Make sure the JDBC driver for your database is accessible by Tomcat. Copy JDBC driver for your version of the database server to $TOMCAT_HOME/lib/ext.

 

Step-4

Liferay requires an additional jar to manage transactions. You may find this .jar here: http://www.oracle.com/technetwork/java/javaee/jta/index.html.

Step-5

Now, Edit $TOMCAT_HOME/conf/catalina.properties file. Change this line

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

to

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

Step-6

Create setenv.bat in $TOMCAT_HOME/bin folder and add these lines:

if exist “[email protected]@/win” (

    if not “%JAVA_HOME%” == “” (

       set JAVA_HOME=

    )

 

    set “[email protected]@/win”

)

 

set “JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m”

 

Step-7

I am deploying liferay in $TOMCAT_HOME/webapps/ROOT folder. So we need to Create the directory $TOMCAT_HOME/conf/Catalina/localhost and create a ROOT.xml file in it. Edit this file and populate it with the following contents to set up a portal web application:

<Context path="" crossContext="true">

 
    <!-- JAAS -->
 
    <!--<Realm
       className="org.apache.catalina.realm.JAASRealm"
       appName="PortalRealm"
       userClassNames="com.liferay.portal.kernel.security.jaas.PortalPrincipal"
       roleClassNames="com.liferay.portal.kernel.security.jaas.PortalRole"
    />-->
 
    <!--
    Uncomment the following to disable persistent sessions across reboots.
    -->
 
    <!--<Manager pathname="" />-->
 
    <!--
    Uncomment the following to not use sessions. See the property
    "session.disabled" in portal.properties.
    -->
 
    <!--<Manager className="com.liferay.support.tomcat.session.SessionLessManagerBase" />-->

</Context>

 

Step-8

Now, Deploy Liferay.

If you are manually installing Liferay on a clean Tomcat server, delete the contents of the $TOMCAT_HOME/webapps/ROOT directory. This undeploys the default Tomcat home page. Then extract the liferay-portal-6.1.x-<date>.war file to $TOMCAT_HOME/webapps/ROOT.

Step-9

Start Tomcat by executing $TOMCAT_HOME/bin/startup.sh

Congratulations on successfully installing and deploying Liferay on Tomcat!

For any confusion, please get in touch with us at Helical IT Solutions

Leave a Reply