liferay 6.2-SP11 on JBoss 7.1

I will show you the steps to install liferay 6.2-SP11 on JBoss 7.1

1 - Download the below files:

     - JBoss 7.1 from here and unzip the folder, This directory is referred to as $JBOSS_HOME throughout this section

     - Liferay 6.2-SP11 EE WAR file from here

     - Liferay 6.2-SP11 EE dependencies jars from here

 

2 - Setup the Dependency Jars:

      - Create the folder structure “com/liferay/portal/main” under “$JBOSS_HOME/modules/.

      - Unzip the downloaded Liferay 6.2-SP11 EE dependencies and copy the jars inside the "main" folder created in the previous step.

      - depending on which database you will use, copy the required driver jar file in the "main" folder (I will add the driver for MySQL "mysql-connector-java-5.1.35-bin.jar" , I downloaded that from here , once you download the zip file unzip it and you will find "mysql-connector-java-5.1.35-bin.jar" inside the folder)

    - Create the file module.xml in the $JBOSS_HOME/modules/com/liferay/portal/main folder and insert the below contents, you can change mysql driver version depending on which one you want to use and you add it to the "main" folder (or remove it if you will not use MySQL) also inlude "<resource-root path="hsql.jar" />" even if you will not use hsql database.

=========================================

     <?xml version="1.0"?>

<module xmlns="urn:jboss:module:1.0" name="com.liferay.portal">
    <resources>
        <resource-root path="hsql.jar" />
        <resource-root path="mysql-connector-java-5.1.35-bin.jar" />
        <resource-root path="portal-service.jar" />
        <resource-root path="portlet.jar" />
    </resources>
    <dependencies>
        <module name="javax.api" />
        <module name="javax.mail.api" />
        <module name="javax.servlet.api" />
        <module name="javax.servlet.jsp.api" />
        <module name="javax.transaction.api" />
    </dependencies>
</module>

============================================

 

3 - configure Jboss:

Please edit/add the below in "$JBOSS_HOME/standalone/configuration/standalone.xml". file.

 

  -  Add the below between the </extensions> and <management>:


 ==========================
  <system-properties>
        <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>
        <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/>
</system-properties>
 =========================


 -  Add the attribute deployment-timeout=”240” in the “<deployment-scanner” tag:


 ====================
 <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000" deployment-timeout="240"/>
 ====================


 -  Add the below security domain to the security subsystem <security-domains> defined in element <subsystem xmlns="urn:jboss:domain:security:1.1">


 =====================
<security-domain name="PortalRealm">
    <authentication>
       <login-module code="com.liferay.portal.security.jaas.PortalLoginModule" flag="required" />
    </authentication>
</security-domain>
 ====================


 -  Disable welcome root of the web subsystem’s virtual server default host by specifying enable-welcome-root="false".


 =========================
<subsystem xmlns="urn:jboss:domain:web:1.5" default-virtual-server="default-host" native="false">
    <configuration>
          <jsp-configuration development="true"/>
    </configuration>
    <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
    <virtual-server name="default-host" enable-welcome-root="false">
       <alias name="localhost" />
       <alias name="example.com" />
    </virtual-server>
</subsystem>
 ========================


 - Add the following <configuration> element inside the web subsystem element <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">

 

==============
<configuration>
        <jsp-configuration development="true"/>
</configuration>
 ===============

 

4 - Modify the startup script:

 a) if you are working on linux machine, remove everything in file "standalone.conf" at  "$JBOSS_HOME/bin/" folder and replace it with the below:

===========================================================

## -*- shell-script -*- ######################################################
##                                                                          ##
##  JBoss Bootstrap Script Configuration                                    ##
##                                                                          ##
##############################################################################

#
# This file is optional; it may be removed if not needed.
#

#
# Specify the maximum file descriptor limit, use "max" or "maximum" to use
# the default, as queried by the system.
#
# Defaults to "maximum"
#
#MAX_FD="maximum"

#
# Specify the profiler configuration file to load.
#
# Default is to not load profiler configuration file.
#
#PROFILER=""

#
# Specify the location of the Java home directory.  If set then $JAVA will
# be defined to $JAVA_HOME/bin/java, else $JAVA will be "java".
#
#JAVA_HOME="/opt/java/jdk"

#
# Specify the exact Java VM executable to use.
#
#JAVA=""

if [ "x$JBOSS_MODULES_SYSTEM_PKGS" = "x" ]; then
   JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman"
fi

# Uncomment the following line to prevent manipulation of JVM options
# by shell scripts.
#
#PRESERVE_JAVA_OPTS=true

#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
   JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
   JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=standalone.xml"
else
   echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
fi

# Sample JPDA settings for remote socket debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

# Sample JPDA settings for shared memory debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=jboss"

# Uncomment to not use JBoss Modules lockless mode
#JAVA_OPTS="$JAVA_OPTS -Djboss.modules.lockless=false"

# Uncomment to gather JBoss Modules metrics
#JAVA_OPTS="$JAVA_OPTS -Djboss.modules.metrics=true"


                    
                        JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true  -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"
                    
               

=================================================================

 

 

    b)If you are working on windows machine edit "standalone.conf" at  "$JBOSS_HOME/bin/" folder with the below:

 

 

=====================================================

## -*- shell-script -*- ######################################################
##                                                                          ##
##  JBoss Bootstrap Script Configuration                                    ##
##                                                                          ##
##############################################################################

#
# This file is optional; it may be removed if not needed.
#

#
# Specify the maximum file descriptor limit, use "max" or "maximum" to use
# the default, as queried by the system.
#
# Defaults to "maximum"
#
#MAX_FD="maximum"

#
# Specify the profiler configuration file to load.
#
# Default is to not load profiler configuration file.
#
#PROFILER=""

#
# Specify the location of the Java home directory.  If set then $JAVA will
# be defined to $JAVA_HOME/bin/java, else $JAVA will be "java".
#
#JAVA_HOME="/opt/java/jdk"

#
# Specify the exact Java VM executable to use.
#
#JAVA=""

if [ "x$JBOSS_MODULES_SYSTEM_PKGS" = "x" ]; then
   JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman"
fi

# Uncomment the following line to prevent manipulation of JVM options
# by shell scripts.
#
#PRESERVE_JAVA_OPTS=true

#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
   JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
   JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=standalone.xml"
else
   echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
fi

# Sample JPDA settings for remote socket debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

# Sample JPDA settings for shared memory debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=jboss"

# Uncomment to not use JBoss Modules lockless mode
#JAVA_OPTS="$JAVA_OPTS -Djboss.modules.lockless=false"

# Uncomment to gather JBoss Modules metrics
#JAVA_OPTS="$JAVA_OPTS -Djboss.modules.metrics=true"


                    
                        JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true  -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"
                    
               

=======================================================================

 

and edit "standalone.conf.bat" at  "$JBOSS_HOME/bin/" folder with the below:

 

=========================================================================

rem ### -*- batch file -*- ######################################################
rem #                                                                          ##
rem #  JBoss Bootstrap Script Configuration                                    ##
rem #                                                                          ##
rem #############################################################################

rem # $Id: run.conf.bat 88820 2009-05-13 15:25:44Z dimitris@jboss.org $

rem #
rem # This batch file is executed by run.bat to initialize the environment
rem # variables that run.bat uses. It is recommended to use this file to
rem # configure these variables, rather than modifying run.bat itself.
rem #

rem Uncomment the following line to disable manipulation of JAVA_OPTS (JVM parameters)
rem set PRESERVE_JAVA_OPTS=true

if not "x%JAVA_OPTS%" == "x" (
  echo "JAVA_OPTS already set in environment; overriding default settings with values: %JAVA_OPTS%"
  goto JAVA_OPTS_SET
)

rem #
rem # Specify the JBoss Profiler configuration file to load.
rem #
rem # Default is to not load a JBoss Profiler configuration file.
rem #
rem set "PROFILER=%JBOSS_HOME%\bin\jboss-profiler.properties"

rem #
rem # Specify the location of the Java home directory (it is recommended that
rem # this always be set). If set, then "%JAVA_HOME%\bin\java" will be used as
rem # the Java VM executable; otherwise, "%JAVA%" will be used (see below).
rem #
rem set "JAVA_HOME=C:\opt\jdk1.6.0_23"

rem #
rem # Specify the exact Java VM executable to use - only used if JAVA_HOME is
rem # not set. Default is "java".
rem #
rem set "JAVA=C:\opt\jdk1.6.0_23\bin\java"

rem #
rem # Specify options to pass to the Java VM. Note, there are some additional
rem # options that are always passed by run.bat.
rem #

rem # JVM memory allocation pool parameters - modify as appropriate.
rem set "JAVA_OPTS=-Xms64M -Xmx512M -XX:MaxPermSize=256M"

rem # Reduce the RMI GCs to once per hour for Sun JVMs.
set "JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true"

rem # Warn when resolving remote XML DTDs or schemas.
set "JAVA_OPTS=%JAVA_OPTS% -Dorg.jboss.resolver.warning=true"

rem # Make Byteman classes visible in all module loaders
rem # This is necessary to inject Byteman rules into AS7 deployments
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.modules.system.pkgs=org.jboss.byteman"

rem # Set the default configuration file to use if -c or --server-config are not used
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.server.default.config=standalone.xml"

rem # Sample JPDA settings for remote socket debugging
rem set "JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

rem # Sample JPDA settings for shared memory debugging
rem set "JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_shmem,address=jboss,server=y,suspend=n"

rem # Use JBoss Modules lockless mode
rem set "JAVA_OPTS=%JAVA_OPTS% -Djboss.modules.lockless=true"


                        
                            set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true  -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"

                            :JAVA_OPTS_SET
                        
                   

===================================================

 

4 - navigate to the $JBOSS_HOME/modules/sun/jdk/main/module.xml file and insert the following path names inside the <paths>...</paths> element:

                                <path name="com/sun/crypto" />
                                <path name="com/sun/crypto/provider" />
                                <path name="com/sun/image/codec/jpeg" />
                                <path name="com/sun/org/apache/xml/internal/resolver" />
                                <path name="com/sun/org/apache/xml/internal/resolver/tools" />

 

5 - Deploy Liferay

  1. If the folder $JBOSS_HOME/standalone/deployments/ROOT.war already exists in your JBoss installation, delete all of its subfolders and files. Otherwise, create a new folder $JBOSS_HOME/standalone/deployments/ROOT.war.

  2. Unzip the Liferay .war file into the ROOT.war folder
     

  3. To trigger deployment of ROOT.war, create an empty file named ROOT.war.dodeploy in your $JBOSS_HOME/standalone/deployments/ folder. On startup, JBoss detects the presence of this file and deploys it as a web application.

  4. Remove eclipselink.jar from $JBOSS_HOME/standalone/deployments/ROOT.war/WEB-INF/lib to insure the Hibernate persistence provider is used instead of the one provided in the eclipselink.jar.

Enjoy :-)