This article documents how to set up Liferay Portal using a war on Tomcat 7.
Resolution
1. Gather the Necessary Files
- Download and unzip the most recent supported version of Tomcat 7.
- Download the most recent Liferay WAR, source code, and dependencies.
2. Dependency Jars
- Create a folder called
extin{$TOMCAT_HOME}/lib/ext. - Extract the dependencies files to
{$TOMCAT_HOME}/lib/ext. - Copy the following jars from
{$build}/lib/developmentto$TOMCAT_HOME/lib/ext:activation.jarjms.jarjta.jarjutf7.jarmail.jarpersistence.jar
- Copy the
ccpp.jarfrom{$build}/lib/portalto{$TOMCAT_HOME}/lib/ext. - Copy the followings jars from
{$build}/lib/developmentto{$TOMCAT_HOME}/lib/ext:resin.jarscript-10.jar
- Download the latest MySQL JDBC driver from the MySQL Connectors page and extract
mysql-connector-java-{$version}-bin.jarto{$TOMCAT_HOME}/lib/ext.
3. Configure the Domain
- Create the file
setenv.batin$TOMCAT_HOME}/bin. - Edit the
setenv.batfile and add the following:if exist "%CATALINA_HOME%/jre@java.version@/win" ( if not "%JAVA_HOME%" == "" ( set JAVA_HOME= ) set "JRE_HOME=%CATALINA_HOME%/jre@java.version@/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"
- Navigate to the folder
{$TOMCAT_HOME}/conf/Catalina/and create a folder calledlocalhost. If those folders do not exist, then create them. - Create the file
ROOT.xmlin{%TOMCAT_HOME}/conf/Catalina/localhost. - Edit the
ROOT.xmland add the following:<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>
- Edit
{$TOMCAT_HOME}/conf/catalina.propertiesand replace
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
with
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 - Edit
{$TOMCAT_HOME}/conf/server.xmland replace
<connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" />
with
<connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8" /> - Navigate to
{$TOMCAT_HOME}/webappsand delete support-catalina.jar if it exists.
4. Deploy the Liferay Portal war
- Navigate to the folder
{$TOMCAT_HOME}/webapps/ROOTand delete the contents. - Extract the contents of the portal
.warto{$TOMCAT_HOME}/webapps/ROOT. - Open a command console to
{$TOMCAT_HOME}/binand enter the commandstartup.bat|shto start the server.