legacy-knowledge-base
Publicado Sep. 25, 2010

Deploying Liferay 6.2 SP 15 on Jboss EAP 6.2

written-by

Ankit Gupta

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

Issue

This article will outline a basic walkthrough on how-to deploy Liferay 6.2 SP 15 on Jboss EAP 6.2 specific to EAP version.         

Environment

  • Liferay 6.2
  • JBoss EAP 6.2 

Resolution

Prerequisite

Dependency Jars

  • Create the folder $JBOSS_HOME\modules\system\layers\base\com\liferay\portal\main. Unzip Liferay Portal Dependencies zip file and copy the jar files to this folder.
  • Create the file module.xml in the $JBOSS_HOME\modules\system\layers\base\com\liferay\portal\main folder and insert the following contents:
<?xml version="1.0"?>  
<module xmlns="urn:jboss:module:1.0"name="com.liferay.portal">
    <resources>
        <resource-root path="mysql-connector-[versionHere]-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>

Since I choose to use hsql to connect the database, modification for <resource-root> would be <resource-root path="hsql.jar"/>                                                                                                                                                     

Configuring JBoss

  1. Go to $JBOSS_HOME\standalone\configuration\standalone.xml, and make the following modifications to standalone.xml:
  •  Add the following system properties between the </extensions> and <management> tags:
<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 a timeout for the deployment scanner by setting deployment-timeout=”240” as seen in the excerpt below:
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
    <deployment-scanner deployment-timeout="240" path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000"/>
</subsystem>

If the value of the deployment scanner remains the same, then you don’t have to make any changes to it.

  •  Add the following JAAS 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>

Locate the subsystem <security-domains> first, and then you may find that in your standalone.xml file the version of domain security is “1.2”, however, you don’t have to change that as the version of it was decided by the Jboss version that you are using. So just copy the above properties to the subsystem within the <security-domains> tag. 

  • Disable the welcome root of the web subsystem’s virtual server default host by specifying enable-welcome-root=”false”. 
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host"> 
    <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>
  • Insert 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>

You can only add this bit <native=”false”> to the end of <subsystem xmlns=”urn:jboss:domain:web:1.1” default-virtual-server=”default-host”>, then add the <configuration> element web subsystem element. Still, for Jboss EAP 6.2 the web subsystem version is “1.5”, same method applies here, we don’t need to change the value here.

2. Go to $JBOSS_HOME/bin folder, make the following modifications to your standalone domain’s configuration script file standalone.conf.bat on Windows

  • Comment out the initial JAVA_OPTS assignment as demonstrated in the following line:

rem set "JAVA_OPTS=-Xms64M -Xmx512M -XX:MaxPermSize=256M"
  • Add the following JAVA_OPTS assignment one line above the JAVA_OPTS_SET line found at end of the file:

set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djava.security.manager -Djava.security.policy=$JBOSS_HOME/bin/server.policy -Djboss.home.dir=$JBOSS_HOME -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"

Changes needed to be made are shown as follows:

  • From $JBOSS_HOME to %JBOSS_HOME%
  • From -Djboss.home.dir=$JBOSS_HOME to -Djboss.home.dir=C:/Users/liferay/Desktop/JBOSS/jboss-eap-6.2

As you need to make sure to replace the $JBOSS_HOME references with the appropriate directory. 

  • 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" />

Security Configuration

Create the $JBOSS_HOME/bin/server.policy file and add the following contents: 

grant {
    permission java.security.AllPermission;
};

Deploy Liferay

  • If the folder $JBOSS_HOME/standalone/deployments/ROOT.war already exists in your JBOSS installation, delete all of its sub-folders and files. Otherwise, create a new folder $JBOSS_HOME/standalone/deployments/ROOT.war. 
  • Unzip the Liferay .war file into the ROOT.war folder.
  • In the ROOT.war file, open the WEB-INF/jboss-deployment-structure.xml file. In this file, replace the <module name=”com.liferay.portal” /> dependency with the following configuration:
<module meta-inf="export" name="com.liferay.portal">
    <imports>
        <include path="META-INF" />
    </imports>
</module>
  • In the same jboss-deployment-structure.xml file, find the <jboss-deployment-structure> tag and update the 1.0 number within the xmlns atrribute to 1.1.
  • 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.
  • Remove eclipselink.jar from $JBOSS_HOME/standalone/deployments/ROOT.war/WEB-INF/lib to ensure the Hibernate persistence provider is used instead of the one provided in the eclipselink.jar.
  • Start the Liferay Portal on JBOSS by navigating to $JBOSS_HOME/bin and running standalone.bat.
did-this-article-resolve-your-issue

legacy-knowledge-base