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:
- Download the Liferay portal bundled with Glassfish from http://downloads.sourceforge.net/lportal/liferay-portal-glassfish-darwin-5.2.2.jar.
- Follow the Quick Installation Instructions - Installing GlassFish from a JAR file from Liferay, with the following additional steps:
- 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 - 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. - 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) - Stop the application server:
$ ./bin/asadmin stop-domain domain1 - 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 ../../../../../../.. - Start the application server again. It should start up OK this time.
$ ./bin/asadmin start-domain domain1 - Be patient, it takes 30-60 seconds to start up Liferay.
- Now, you can navigate to your portal at http://localhost:8080/.
- 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
- Start with Netbeans 6.5
- Add the Portal Pack. I did this by downloading portal-pack-plugin-3_0_all.zip from the Portal Pack downloads page.
- 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.

Hi Ari. Did you try using WebSpace Server instead? - eduard/o
Posted by Eduardo Pelegri-Llopart on April 02, 2009 at 12:22 AM 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 12:00 PM EDT #