legacy-knowledge-base
Publicado Sep. 25, 2010

Setting Up Liferay WAR on Tomcat 7

written-by

Liferay Support

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

This article describes how to set up Liferay Portal 6.1 EE or Liferay Portal 6.2 EE using Windows and MySQL 5.x on Apache Tomcat 7.x.

Resolution

1. Gather the Necessary Files

  1. Download and unzip the most recent supported version of Tomcat 7: http://archive.apache.org/dist/tomcat/tomcat-7/
  2. The unzipped local folder where Apache Tomcat is located will be abbreviated: ${TOMCAT_HOME}.
  3. Download the most recent Liferay.war file and Liferay Portal source files and dependencies. Liferay WAR and dependencies.

2. Dependency Jars

  1. Create a folder called ext inside  {$TOMCAT_HOME}/lib/ .
  2. If there is also a downloaded Tomcat bundle, administrators also have the option copy all the files from that bundle's {$TOMCAT_HOME}/lib/ext  folder and place them in this current Tomcat server's {$TOMCAT_HOME}/lib/ext folder. After that, skip to step 5.
  3. However, if developers are building Liferay and using that for the dependencies, extract the dependencies files to {$TOMCAT_HOME}/lib/ext
  4. Copy the following jars from the liferay-portal-src-6.x-ee-spXX/lib/development to $TOMCAT_HOME/lib/ext folder. (These can also be taken from an existing bundle.):
    • activation.jar
    • jms.jar
    • jta.jar
    • jutf7.jar
    • mail.jar
    • persistence.jar
    • resin.jar
    • script-10.jar
  5. Copy the ccpp.jar from liferay-portal-src-6.x-ee-spXX/lib/portal to the {$TOMCAT_HOME}/lib/ext folder.
  6. If using MySQL, download the latest MySQL JDBC driver http://www.mysql.com/products/connector/ and place mysql-connector-java-{$version}-bin.jar to the {$TOMCAT_HOME}/lib/ext folder.

3. Configure the Domain

  1. Create setenv.bat|sh in ${TOMCAT_HOME}/bin

  2. For Windows users, edit setenv.bat with 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"
    		
  3. Create the folder Catalina inside  {$TOMCAT_HOME}/conf/ .
  4. Create the folder localhost inside  {$TOMCAT_HOME}/conf/Catalina .
  5. Create the file ROOT.xml in {%TOMCAT_HOME}/conf/Catalina/localhost.
  6. Edit ROOT.mxl  with 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>
    	
  7. Edit {$TOMCAT_HOME}/conf/catalina.properties and 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
  8. Edit {$TOMCAT_HOME}/conf/server.xml and replace
    <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
    with
    <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />
  9. Navigate to {$TOMCAT_HOME}/webapps and delete support-catalina.jar if it exists.

4. Deploy Liferay

  1. Navigate to {$TOMCAT_HOME}/webapps/ and delete the contents including the ROOT.
  2. Create a new ROOT folder.
  3. Extract the contents of liferay-portal-6.x.x.war to {$TOMCAT_HOME}/webapps/ROOT
  4. Open a command console to {$TOMCAT_HOME}/bin and start the application server.
did-this-article-resolve-your-issue

legacy-knowledge-base