Monday, December 30, 2013

Installing Liferay 6.1.30 on JBoss EAP 6.1 on Windows (Part 2)

In my previous post, I showed you how to get JBoss EAP 6.1 running on a standard Windows 8 setup. We walked through downloading the prerequisites, installing them, configuring the java environment, configuring JBoss EAP, then finally creating an admin user and signing in the first time. This time, we will be tailoring JBoss EAP for Liferay 6.1.30EE, deploying the Liferay packages, and starting up Liferay using the default settings.

Part 0 - Prerequisites

As before, there are several things we need to download.

Part 1 - Installing Liferay's Dependencies

Your previously installed JBoss EAP home folder should contain a "modules" subfolder. Beneath this folder, you need to create three nested directories as follows:
$jboss/modules/com/liferay/portal/main
Once this has been created, extract the contents of the Liferay dependency archive to this folder.

Also copy over the sqljdbc4.jar file from the SQL Server JDBC 4.0 driver. If you installed it instead of extracting the SQL Server driver's contents, it will have been put here: <install path><sqljdbc_<version>\<language>\sqljdbc4.jar.

Next, you need to create a module.xml file in the same folder as the extracted dependency jar files and paste the following content into the file:
<?xml version="1.0"?>

<module xmlns="urn:jboss:module:1.0" name="com.liferay.portal">

    <resources>

       <resource-root path="sqljdbc4.jar" />
       <resource-root path="hsql.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>
Thats it. Your dependencies are now installed and referenced. Next up, we will need to make some changes to JBoss's configuration to work with Liferay.

Part 2 - Modifying JBoss

We will start off by modifying the JBoss standalone.xml configuration file. This file is in the $jboss\standalone\configuration\ folder.

Step 1 - Disable the default JBoss content & turn on JSP dev settings.

Find and disable the enable-welcome-root attribute in the virtual server section under the web subsystem, then add a configuration element to the section as indicated below:
        
<subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" native="false">
    <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="atlas"/>
    </virtual-server>
    <configuration>
        <jsp-configuration development="true" />
    </configuration>
</subsystem>

Step 2- Configure the Security Domain

Find the JAAS security subsystem element, and just before the </security-domains> closing tag, add the following:
<security-domain name="PortalRealm">
    <authentication>
       <login-module code="com.liferay.portal.security.jaas.PortalLoginModule" flag="required"/>
    </authentication>
</security-domain>

Part 3 - Deploying the Liferay WAR

For JBoss to deploy Liferay, you must extract and place the Liferay WAR package into the ROOT.war folder under the $jboss\standalone\deployments folder. If a ROOT.war folder doesn't already exist, create one and extract the contents of the liferay WAR package there.

If you are running the EE version of Liferay, you will also need to place the XML license file into the $jboss\..\deploy folder. This is the deploy folder one level UP from the JBoss home folder. If you are running the CE version, no license is required.

Finally, you should create a file called ROOT.war.dodeploy to indicate to JBoss that you want the contents of the ROOT.war folder deployed at runtime.

Part 3.5 - Configure Java Options (Optional for test installs)

If you are simply testing our the Liferay installation procedure and don't plan to use Liferay to accomplish anything, you can skip this step. If you intent to import documents, content, users, and do some useful work within Liferay, you should tweak some basic Java runtime settings to give the portal enough RAM to run reliably.

In the $jboss\bin folder, find standalone.conf.bat file and open it. edit the Java options near the bottom as follows:
rem # JVM memory allocation pool parameters - modify as appropriate.
set "JAVA_OPTS=-Xms1303M -Xmx1303M -XX:MaxPermSize=256M"

rem # Prefer IPv4
set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Duser.timezone=GMT"

Save your changes.

Part 4 - Starting Liferay for the first time

At this point, you've configured JBoss EAP 6.1, Installed the Liferay dependencies, extracted the Portal, indicated to JBoss you want it deployed, and possibly configured some JVM settings. At this time, you can start JBoss and let it deploy Liferay by running the standalone.bat file in the $jboss\bin\ folder.

After a few moments (it could take a couple minutes on an older machine), a browser window should open automatically to the address http://localhost:8080 and you will see the following screen.

You can leave the default settings alone to install Liferay using the Hypersonic (HSQL) database engine.

Congratulations, you've installed Liferay on JBoss EAP 6.1. In the next installment, we will create a Liferay portal database instance on SQL Server and configure Liferay to use it, then finalize our installation by cleaning up a few folders and performing some general housekeeping tasks.

Friday, December 13, 2013

Installing Liferay 6.1.30 on JBoss EAP 6.1 on Windows (Part 1)

Installing Liferay Portal 6.1.30EE under JBoss EAP 6.1.1 on Windows 8

I've been working on a project for a client implementing a new portal application to replace their aging WebSphere installation. The technology stack chosen was Java, SQL Server, JBoss EAP, IIS, Windows Server, and finally Liferay portal.
This is the first in a multi-part series on configuring Liferay to run within the environment described above.

Part 0 - Prerequisites

I am assuming you have a Windows 2008+ server (or Windows 7/8) and can comfortably install the prerequisites for running an application server and a portal. These pre-requisites include:

  • Windows O/S - I'll be using windows 8, but I've confirmed the steps are the same on Server 2008 & Server 2012
  • Java - I'm using Oracle JDK 1.7u40 64-bit version, I put my sdk in c:\java and the jre in c:\java\jre
  • Microsoft SQL Server - I'm using SQL 2012, 2008/2005 should work the same
  • IIS 7.5
  • Application Request Routing
  • You've set your JAVA_HOME and JAVA environment variables correctly.

Part 1 - JBoss EAP 6.1 on Windows

Just getting the application server running takes several steps. Since JBoss doesn't come with an "installer" we will be extracting the zip file and configuring the server by hand. It really isn't that hard.

Part 1.a Create Liferay home folder

Since Liferay prefers to run on a dedicated application server, the first step is to create your Liferay home folder. I'm using C:\Liferay\LiferayPortal6.1.30\ as my Liferay home folder. The reason for this is because I'm writing this using my workstation, and I will be installing Liferay portal 6.2.1 in another directory right beside my older Liferay install to test upgrade procedures. Your environment say be best suited by using a separate volume with only a folder "Liferay" in the root. I wouldn't recommend putting the liferay install directly on the root of a volume, but it should work that way in theory.

Create your liferay home folder:

C:
md C:\liferay\LiferayPortal6.1.30\
cd C:\liferay\LiferayPortal6.1.30\

Part 1.b "Install" JBoss

Extract the contents of the jboss-eap-6.1.1.zip folder to your newly created Liferay home folder. The Liferay home folder should have a single folder under it called jboss-eap-6.1. There really isn't anything else to getting JBoss "installed". *Note: I've found that the Windows Explorer built-in zip file handler is basically horrible. Use a decent extractor like 7-Zip to work with these archives.

Part 1.c Add Management User

Navigate to the jboss-eap-6.1\bin folder and use the add-user.bat script to create a new management user.
C:\Liferay\LiferayPortal6.1.30\jboss-eap-6.1\bin>add-user

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): a

Enter the details of the new user to add.
Realm (ManagementRealm) :(just press enter)
Username : jbharris
Password :
Re-enter Password :
About to add user 'jbharris' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'jbharris' to file 'C:\Liferay\LiferayPortal6.1.30\jboss-eap-6.1\standalone\configuration\mgmt-users.properties'
Added user 'jbharris' to file 'C:\Liferay\LiferayPortal6.1.30\jboss-eap-6.1\domain\configuration\mgmt-users.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? no
Press any key to continue . . .

C:\Liferay\LiferayPortal6.1.30\jboss-eap-6.1\bin>

Part 1.d Fire up JBoss

Now you can start your JBoss EAP 6.1 portal using the basic/standalone configuration. Run standalone.bat to fire up the server.
C:\Liferay\LiferayPortal6.1.30\jboss-eap-6.1\bin>standalone.bat
Calling "C:\Liferay\LiferayPortal6.1.30\jboss-eap-6.1\bin\standalone.conf.bat"
Setting JAVA property to 'c:\java\bin\java'
===============================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: C:\Liferay\LiferayPortal6.1.30\jboss-eap-6.1

  JAVA: c:\java\bin\java

  JAVA_OPTS: -XX:+TieredCompilation -XX:+UseCompressedOops -Dprogram.name=standalone.bat -Xms1303M -Xmx1303M -XX:MaxPermSize=256M -Djava.net.preferIPv4Stack=tru
e -Djboss.modules.system.pkgs=org.jboss.byteman

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

09:57:23,064 INFO  [org.jboss.modules] (main) JBoss Modules version 1.2.2.Final-redhat-1
09:57:23,181 INFO  [org.jboss.msc] (main) JBoss MSC version 1.0.4.GA-redhat-1
09:57:23,221 INFO  [org.jboss.as] (MSC service thread 1-6) JBAS015899: JBoss EAP 6.1.1.GA (AS 7.2.1.Final-redhat-10) starting
09:57:23,855 INFO  [org.xnio] (MSC service thread 1-12) XNIO Version 3.0.7.GA-redhat-1
09:57:23,856 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
09:57:23,861 INFO  [org.xnio.nio] (MSC service thread 1-12) XNIO NIO Implementation Version 3.0.7.GA-redhat-1
09:57:23,867 INFO  [org.jboss.remoting] (MSC service thread 1-12) JBoss Remoting version 3.2.16.GA-redhat-1
09:57:23,891 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 29) JBAS010280: Activating Infinispan subsystem.
09:57:23,894 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 37) JBAS011800: Activating Naming Subsystem
09:57:23,898 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 42) JBAS013171: Activating Security Subsystem
09:57:23,901 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 46) JBAS015537: Activating WebServices Extension
09:57:23,914 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 35) JBAS012605: Activated the following JSF Implementations: [main, 1.2]
09:57:23,926 INFO  [org.jboss.as.security] (MSC service thread 1-9) JBAS013170: Current PicketBox version=4.0.17.SP2-redhat-2
09:57:23,943 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-10) JBAS010408: Starting JCA Subsystem (IronJacamar 1.0.19.Final-redhat-2)
09:57:23,963 INFO  [org.jboss.as.naming] (MSC service thread 1-14) JBAS011802: Starting Naming Service
09:57:23,975 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-13) JBAS015400: Bound mail session [java:jboss/mail/Default]
09:57:24,012 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 25) JBAS010403: Deploying JDBC-compliant driver class org.h2.Dr
iver (version 1.3)
09:57:24,095 INFO  [org.jboss.ws.common.management] (MSC service thread 1-16) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.1.4.Final-redhat-7
09:57:24,240 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-13) JBAS015012: Started FileSystemDeploymentService for directory C:\Liferay\L
iferayPortal6.1.30\jboss-eap-6.1\standalone\deployments
09:57:25,034 INFO  [org.jboss.as.remoting] (MSC service thread 1-11) JBAS017100: Listening on 127.0.0.1:9999
09:57:25,034 INFO  [org.jboss.as.remoting] (MSC service thread 1-4) JBAS017100: Listening on 127.0.0.1:4447
09:57:25,045 INFO  [org.apache.coyote.http11] (MSC service thread 1-6) JBWEB003001: Coyote HTTP/1.1 initializing on : http-/127.0.0.1:8080
09:57:25,049 INFO  [org.apache.coyote.http11] (MSC service thread 1-6) JBWEB003000: Coyote HTTP/1.1 starting on: http-/127.0.0.1:8080
09:57:25,145 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-15) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
09:57:25,211 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
09:57:25,211 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
09:57:25,212 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.1.1.GA (AS 7.2.1.Final-redhat-10) started in 2404ms - Started 123 of 177 serv
ices (53 services are passive or on-demand)
At this point you can open your browser and navigate to http://localhost:8080 and JBoss will display the default welcome content.

Check this now to make sure your most basic config works. If you aren't getting this content you should stop now and confirm the previous steps. Check your console output to make sure there aren't any configuration or permission errors.

 You should also make sure your user account was created properly by clicking the "Administration Console" link and giving it the credentials you set up. You should get the server status screen.

Notice the url is actually now http://localhost:9990/. You will be returning to this URL again and again to tweak JBoss's settings.

In the next installment we will be deploying the Liferay portal dependencies and configuring JBoss to run Liferay.