Setting Up Liferay Portal 6.2 on JBoss 7.1.3.

This article contains a basic deployment of Liferay Portal 6.2 with JBoss 7.1.3. Keep in mind that this is just a basic setup and may have to be tweaked for specific environments.

Resolution

1. Obtain a copy of:

  • JBoss 7.1.3
  • liferay-portal-6.2.10.1-ee-ga1-20131126141110470.war
  • liferay-portal-dependencies-6.2.10.1-ee-ga1-20131126141110470.zip
  • liferay-portal-src-6.2.10.1-ee-ga1-20131126141110470.zip.

2. Create folder $JBOSS_HOME/modules/com/liferay/portal/main and unzip the jar files found in the Liferay Portal Dependencies zip file to this folder. Make sure the zip file’s jar files are extracted into the $JBOSS_HOME/modules/com/liferay/portal/main folder.

3. Download your database driver .jar file and put it into the $JBOSS_HOME/modules/com/liferay/portal/main folder as well. For demonstration purposes, we’ll download the MySQL Connector/J driver and put its .jar file into the $JBOSS_HOME/modules/com/liferay/portal/main folder.

4. Download the jtds-<JTDS_VERSION>.jar. file and insert it into the $JBOSS_HOME/modules/com/liferay/portal/main folder. You can download and learn more about this JDBC driver at the jTDS home page.

5. Create a file called module.xml in $JBOSS_HOME/modules/com/liferay/portal/main. This will reference the dependencies:

<?xml version="1.0"?>

<module xmlns="urn:jboss:module:1.0" name="com.liferay.portal">
   <resources>
       <resource-root path="hsql.jar" />
       <resource-root path="jtds-1.3.1.jar" />
       <resource-root path="mysql.jar" />
       <resource-root path="portal-service.jar" />
       <resource-root path="portlet.jar" />
   </resources>
   <dependencies>
       <module name="ibm.jdk" />
       <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>

If you’re using a different database or JDBC driver, replace the paths of the MySQL and jTDS resource root entries with the correct paths.

6. Next, you’ll need to include a patch from Liferay’s source code for one of JBoss’ default .jar files. Once you’ve downloaded the Liferay source, unzip the source into a temporary folder. We’ll refer to the location of the Liferay source as $LIFERAY_SOURCE.

7.  We will next configure Standalone Mode

  1. Make the following modifications to $JBOSS_HOME/standalone/configuration/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>
    
  2. 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>
    
  3. Add the following JAAS security domain to the security subsystem <security-domains> defined in element <subsystem xmlns="urn:jboss:domain:security:1.2">.
    <security-domain name="PortalRealm">
       <authentication>
           <login-module code="com.liferay.portal.security.jaas.PortalLoginModule" flag="required" />
       </authentication>
    </security-domain>
    
  4. 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.2" 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>
    
  5. Insert the following <configuration> element within the web subsystem element <subsystem xmlns="urn:jboss:domain:web:1.2" default-virtual-server="default-host" native="false">.
    <configuration>
       <jsp-configuration development="true" />
    </configuration>
    

8. Make changes to Standalone domain's configuration script - $JBOSS_HOME/bin/standalone.conf (or standalone.conf.bat in Windows)

  1. On Windows, comment out the initial JAVA_OPTS assignment as demonstrated in the following line:

    rem set JAVA_OPTS=-Xms64M -Xmx512M -XX:MaxPermSize=256M

    Then 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=server.policy- Djboss.home.dir=$JBOSS_HOME -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m
  2. On Unix, merge the following values into your settings for JAVA_OPTS replacing any matching attributes with the ones found in the assignment below:
    JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djava.security.manager -Djava.security.policy=server.policy -Djboss.home.dir=$JBOSS_HOME -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m

9. Create folder $JBOSS_HOME/modules/ibm/jdk/main and create and modify the module.xml file in this folder.

10. Replace the existing module.xml file with the following contents into the $JBOSS_HOME/modules/ibm/jdk/main/module.xml file:

<?xml version="1.0"?>

<module xmlns="urn:jboss:module:1.1" name="ibm.jdk">
   <dependencies>
       <system export="true">
           <paths>
               <path name="com/ibm" />
               <path name="com/ibm/crypto/provider" />
               <path name="com/ibm/jvm" />
               <path name="com/ibm/jvm/io" />
               <path name="com/ibm/jvm/util" />
               <path name="com/ibm/match" />
               <path name="com/ibm/misc" />
               <path name="com/ibm/net" />
               <path name="com/ibm/nio" />
               <path name="com/ibm/nio/ch" />
               <path name="com/ibm/security/auth" />
               <path name="com/ibm/security/bootstrap" />
               <path name="com/ibm/security/auth/module" />
               <path name="com/ibm/security/util" />
               <path name="META-INF/services" />
           </paths>
       </system>
   </dependencies>
</module>

11. 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/org/apache/xml/internal/resolver" />
<path name="com/sun/org/apache/xml/internal/resolver/tools" />

12. Security Configuration

When you’re ready to begin using other people’s apps from Marketplace, you’ll want to protect your portal and your JBoss server from security threats. To do so, you can enable Java Security on your JBoss server and specify a security policy to grant your portal access to your server.

  • Remember, we set the -Djava.security.manager and -Djava.security.policy Java options in the standalone.conf.bat file earlier in the Configuring JBoss section. The -Djava.security.manager Java option enables security on your JBoss server. Likewise, the -Djava.security.policy Java option lists the permissions for your server’s Java security policy. If you have not set these options, you’ll need to do so before using Java security.
  • For now, in order to grant Liferay access to your server let’s open up all permissions. You can tune the permissions in your policy later. Create the $JBOSS_HOME/bin/server.policy file and add the following contents:
  • grant {
       permission java.security.AllPermission;
    };

For extensive information on Java SE Security Architecture, see its specification documents on Oracle's Java SE Documentation site. Also, see section Understanding Plugin Security Management in Chapter 12 of Liferay's Developer’s Guide to learn how to configure Portal plugin access to resources.

13. Create a new folder $JBOSS_HOME/standalone/deployments/ROOT.war.

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

15. 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.

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

17. We will need to update the picketbox library (4.0.13 in JBoss 7.1.3) from the JBoss repositories.

  1. You can obtain them from the following links:
  2. Once these are obtained, copy them to $JBOSS_HOME\modules\org\picketbox\main
  3. We will now modify $JBOSS_HOME\modules\org\picketbox\main\modules.xml as follows:
    <resources>
       <resource-root path="picketbox-4.0.15.Final.jar"/>
       <resource-root path="picketbox-infinispan-4.0.15.Final.jar"/>
       <resource-root path="picketbox-commons-1.0.0.final.jar"/>
       <!-- Insert resources here -->
    </resources>
    

18. Start the JBoss application server.

19. Deploy licenses.

Portal is now ready for use.

这篇文章有帮助吗?
0 人中有 0 人觉得有帮助