Deploying Liferay into an existing Glassfish Container

In a previous blog entry, I described how to get started with LifeRay.  I wanted to use the latest version of GlassFish, so I went through the effort to figure out how to deploy LifeRay into an existing instance of GlassFish.  This blog describes how to do this.

Follow these steps to get LifeRay deployed on an existing (or new) instance of GlassFish:

  1. Download GlassFish v2.1 from https://glassfish.dev.java.net/downloads/v2.1-b60e.html and follow the installation instructions on this page.
  2. Start the domain, test it, make sure it is working.  These examples assume you used the "setup.xml" file that is distributed with GlassFish.  If not, please adjust accordingly.

    $ ./bin/asadmin start-domain domain1

  3. Download the Liferay Portal 5.2.2 WAR file as described here: http://www.liferay.com/web/guest/downloads/additional, and deploy it.

    $ ./bin/asadmin deploy ~/downloads/liferay-portal-5.2.2.war
    Command deploy executed successfully.


  4. Take a look at the log file, you will see lots of java.lang.ClassNotFoundException  exceptions:

    $ less domains/domain1/logs/server.log

  5. In preparation for fixing the errors, shut down GlassFish:

    $ ./bin/asadmin stop-domain domain1
    Domain domain1 stopped.


  6. Download the Liferay Portal 5.2.2 Dependencies as described here: http://www.liferay.com/web/guest/downloads/additional, and unpack the ZIP file somewhere.
  7. Copy the JAR files in the ZIP file into the domain/domain1/lib directory:

    $ cp ~/downloads/liferay-portal-dependencies-5.2.2/\*.jar domains/domain1/lib

  8. Copy the three extra JAR files needed from the LifeRay deployment into the domains/domain1/lib directory as well:

    $ cp domains/domain1/applications/j2ee-modules/liferay-portal-5.2.2/WEB-INF/lib/xalan.jar domains/domain1/lib
    $ cp domains/domain1/applications/j2ee-modules/liferay-portal-5.2.2/WEB-INF/lib/xercesImpl.jar domains/domain1/lib
    $ cp domains/domain1/applications/j2ee-modules/liferay-portal-5.2.2/WEB-INF/lib/serializer.jar domains/domain1/lib


  9. Start up the app server again:

    $ ./bin/asadmin start-domain domain1

  10. You are now good to go, with LifeRay deployed
  11. A suggestion: you may start seeing "java.lang.OutOfMemoryError: PermGen space" errors in the server log file.  I started seeing these errors as soon as I deployed my app in addition to LifeRay, using JDK 1.6 on MacOS 10.5.6.  The default 192MB setting for GlassFish does not seem to be sufficient.  I increased the setting to 384MB by editing the file domains/domain1/config/domain.xml:

    $ grep -i perm domains/domain1/config/domain.xml
            <jvm-options>-XX:MaxPermSize=384m</jvm-options>

Comments:

Excellent article. I followed it, adapting it to Net Beans 6.5. i.e. I used NB services to start and stop GF. I also used GF admin console to deploy liferay war file, and adding JVM options. GF is now running with liferay I think. However, I can not figure how to get to the liferay via the browser. I have tried http://localhost:8080/liferay-portal-5.2.2 and http://localhost:8080/applications/j2ee-modules/liferay-portal-5.2.2. Can anyone supply the right URL?

Posted by Brian on May 06, 2009 at 03:39 AM EDT #

Hi Brian - on my local system, Liferay installs itself as the local context, meaning to access it, you simply use this url:

http://localhost:8080/

You can take a look at your server.log log file (glassfish/domains/domain1/logs/server.log), you may be getting exceptions in there that are preventing liferay from starting up properly.

Posted by Ari Shamash on May 22, 2009 at 01:19 AM EDT #

Sigh.. Just noticed a minor mistake in my previous comment:

s/local context/default context/

Too early in the morning, not enough coffee yet. I should learn not to post anything before I finish my first few cups..

To view the context configuration in glassfish's excellent admin tool:

1) Login (default http://localhost:4848/, may vary depending on your configuration)

2) Click "configuration"

3) Click "HTTP Service"

4) Click "Virtual Servers"

5) Click "server"

You'll see the default web application listed as a dropdown on the right side of the screen.

Posted by Ari Shamash on May 22, 2009 at 01:23 AM EDT #

When i try to launch the application its throwing errors..

[#|2009-06-07T10:29:48.025-0400|SEVERE|sun-appserver2.1|javax.enterprise.system.container.web|_ThreadID=10;_ThreadName=main;_RequestID=930f8b15-7202-4021-93b4-92e9da8064b7;|WebModule[]PWC1275: Exception sending context initialized event to listener instance of class com.liferay.portal.spring.context.PortalContextLoaderListener
java.lang.NoClassDefFoundError: com/liferay/util/SystemProperties
at com.liferay.portal.util.InitUtil.init(InitUtil.java:64)
at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext

and this class com.liferay.util.SystemProperties is not there in any of the jars in the classpath and even not there in the liferay-portal-dependencies-5.2.2 jars .. It seems to be there in even previous version 4.2.2

Posted by Rishi on June 08, 2009 at 05:38 AM EDT #

Hi Ari

Great Post. I've followed similar instructions for the latest release of Liferay and Glassfish and seems to be running well so far - just a few errors in the log to look into. I've posted the details here: http://www.greatwhiteit.com/web/guest/home/-/blogs/how-to-install-liferay-on-the-glassfish-application-server-over-ssh

-Garry

Posted by Garry Donnelly on April 21, 2010 at 06:11 PM EDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Ari Shamash is the software engineering manager of the Sun Software Library engineering team at Sun Microsystems.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today