Getting started with Glassfish, Liferay, Netbeans, PortalPack, and HelloWorld Portlet

Recently, I had a task to build a HelloWorld portlet deployed to a liferay portal server.  I looked around, couldn't find any up to date blog entries that really covered this topic.  After I went through the startup pain, I figured I'd share my findings.

The examples below work on Mac OS X v10.5.6 using Java 1.6.

I followed these steps to get it working.

First major step is to get Glassfish working with Liferay on your Mac:

  1. Download the Liferay portal bundled with Glassfish from http://downloads.sourceforge.net/lportal/liferay-portal-glassfish-darwin-5.2.2.jar.
  2. Follow the Quick Installation Instructions - Installing GlassFish from a JAR file from Liferay, with the following additional steps:
    1. To finish the Liferay installation, you need to start up the Glassfish app server.  The following command will work, assuming you did not change the domain name in the setup.xml file:

      $ ./bin/asadmin start-domain domain1
    2. Look in the log files:

      $ tail -f domains/domain1/logs/server.log

      Look for these kind of entries:

      [AutoDeploy] Selecting file /Users/ashamash/projects/omalley/liferay-portlet/glassfish/domains/domain1/autodeploy/liferay-portal.war for autodeployment.
    3. Ultimately, you will see an error message:

      java.lang.NoSuchMethodError: org.apache.xml.utils.DefaultErrorHandler.<init>(Z)V
              at org.apache.xalan.processor.TransformerFactoryImpl.<init>(TransformerFactoryImpl.java:1002)

    4. Stop the application server:

      $ ./bin/asadmin stop-domain domain1
    5. Copy the following libraries into the ./lib directory:

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

      $ cd ../../../../../../..
    6. Start the application server again.  It should start up OK this time.

      $ ./bin/asadmin start-domain domain1
    7. Be patient, it takes 30-60 seconds to start up Liferay.
    8. Now, you can navigate to your portal at http://localhost:8080/.
  3. Now that you have Liferay working for you, you can log in via the credentials provided on the Quick Start Guide:
    • Email address: bruno@7cogs.com
    • Password: bruno
You are now ready to build your first HelloWorld portlet.  I did this with Netbeans and the Portal Pack.  Follow these steps:
  1. Start with Netbeans 6.5
  2. Add the Portal Pack.  I did this by downloading portal-pack-plugin-3_0_all.zip from the Portal Pack downloads page.
  3. Go through the Getting Started with Portal Pack 3.0 tutorial, it's really good, it took me a grand total of 10 minutes to build the HelloWorld portlet.

The advantage of using a Netbeans Portal Pack is that Netbeans takes care of all the packaging and deployment stuff for you.  I was able to build, deploy, and run my portlet simply by running the project.  Pretty neat stuff.

Netbeans

Comments:

Hi Ari. Did you try using WebSpace Server instead? - eduard/o

Posted by Eduardo Pelegri-Llopart on April 01, 2009 at 05:22 PM EDT #

Hi Eduardo - the deployment platform (liferay 5.2) for our portlet was chosen independently of us, we were setting up a development environment to use for building and testing the portlet.

We did look at WebSpace Server - http://www.sun.com/software/products/webspace/index.xml and https://webspace.dev.java.net/, it is quite nice.

Posted by Ari Shamash on April 06, 2009 at 05:00 AM EDT #

Can i use portal pack 3 with Apache server?

Posted by Suranga on March 10, 2011 at 04:10 PM EST #

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