Setting Up Liferay 6.1 EE GA3 or 6.2 WAR on Tomcat 8

This article describes how to set up Liferay Portal 6.1 EE GA3 or 6.2 EE on Tomcat 8 Server.

Resolution

1. Gather the Necessary Files

  1. Download and unzip the latest version of Tomcat 8.
  2. Download the most recent 6.1 EE GA3 SP5 war or Liferay 6.2 .war file
  3. Download the 6.1 EE GA3 or 6.2 EE bundle and dependencies files.

2. Dependency Jars

  1. Once you have unzipped your tomcat server, create a folder {$TOMCAT_HOME}/lib/ext
  2. From the downloaded 6.2 Tomcat bundle, copy all the files from the bundle's {$TOMCAT_HOME}/lib/ext and place them in this new Tomcat server's {$TOMCAT_HOME}/lib/ext folder. After that, skip to step 6.
  3. However, if you are building Liferay Portal, and using that for the dependencies, then extract the dependency files to {$TOMCAT_HOME}/lib/ext
  4. Copy the following jars from {$build}/lib/development to $TOMCAT_HOME/lib/ext (These can also be taken from an existing bundle.)
    • activation.jar
    • jms.jar
    • jta.jar
    • jutf7.jar
    • mail.jar
    • persistence.jar
  5. Copy ccpp.jar from {$build}/lib/portal to {$TOMCAT_HOME}/lib/ext
  6. OPTIONAL: Copy the followings jars from {$build}/lib/development to {$TOMCAT_HOME}/temp/liferay/com/liferay/portal/deploy/dependencies
  7. Download the latest MySQL JDBC driver MySQL Connector and extract mysql-connector-java-{$version}-bin.jar to {$TOMCAT_HOME}/lib/ext

3. Configure the Domain

  1. Create setenv.bat|sh in [$TOMCAT_HOME}/bin
    1. In a Windows environment, edit the setenv.bat file by adding 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=384m"
    2. In a Unix/Linux environment, edit the setenv.sh file by adding the following:
      CATALINA_OPTS="$CATALINA_OPTS -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=384m"
    3. Note that on Unix or Linux environments, the export command is used (not set).

    4. On Unix and Linux environments, it is possible to set up a different JAVA_HOME or JRE_HOME that is different from the default JAVA path. One such scenario is if there are multiple JDKs and JREs installed so that system administrators run multiple Liferay bundles with different portal versions on the same server. Another common scenario is when system administrators want to grant limited systems access to Liferay on Tomcat 8 so that the bundle is not using any global settings.

      Here is an older example (modify the folder directory and JDK version as necessary). To implement this, enter in the terminal console:
      export JAVA_HOME=/usr/java/jdk1.7.0_21
      export PATH=$JAVA_HOME/bin:$PATH
      export CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar

      Note: These settings are not permanent; when the shell console is closed, the settings are not saved. To save settings, add the configuration to where the settings are stored (for example, etc/profile.d in CentOS).
  2. Create the directory {$TOMCAT_HOME}/conf/Catalina/localhost
  3. Create ROOT.xml in {%TOMCAT_HOME}/conf/Catalina/localhost
  4. Edit ROOT.xml and 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>
  5. Edit {$TOMCAT_HOME}/conf/catalina.properties and replace

    common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jarwith
    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
  6. 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" />
  7. Navigate to {$TOMCAT_HOME}/webapps and delete support-catalina.jar if it exists.
  8. Navigate to {$TOMCAT_HOME}/conf and open context.xml. Replace the contents with (be sure to rename the username, password and url parameters to point to your own environment):

    <?xml version='1.0' encoding='utf-8'?>
    <Context>
        <WatchedResource>WEB-INF/web.xml</WatchedResource>
        <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
        <Resources
            cachingAllowed="true"
            cacheMaxSize="100000" />
        <Resource name="jdbcliferay"
            auth="Container"
            type="javax.sql.DataSource"
            maxActive="64"
            maxIdle="16"
            maxWait="1000"
            username="root"
            password=""
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost/lp_621_ga2_patched?useUnicode=true&amp;characterEncoding=UTF-8&amp;useFastDateParsing=false&amp;autoReconnect=true"
            validationQuery="select 1" />
    </Context>

4. Deploy Liferay

  1. Navigate to {$TOMCAT_HOME}/webapps/ROOT and delete the contents.
  2. Extract the contents of the Liferay Portal 6.1 EE GA3 SP5 .war or liferay-portal-6.2.0.war to {$TOMCAT_HOME}/webapps/ROOT.
  3. Create a portal-ext.properties file in {$LIFERAY_HOME} and add the following line to point to the data source configuration: jdbc.default.jndi.name=jdbcliferay
  4. Open a command console to {$TOMCAT_HOME}/bin and type in startup.bat (or ./catalina.sh run in Unix/Linux) to start the server
这篇文章有帮助吗?
0 人中有 0 人觉得有帮助