Liferay with GlassFish
Install Liferay with GlassFish Bundle#
- Memory: 1GB RAM Disk Space: 500MB
- System Architecture: X86/SPARC
- Operating System: Solaris/Linux/MacOS X/Windows/AIX
- JDK 1.6.x/1.5.x (Only 1.5.x on Mac)
- Apache Ant
- Download Liferay bundled with Glassfish for your platform from http://www.liferay.com/web/guest/downloads/portal
- java -Xmx256m -jar liferay-portal-glassfish-(platform)-(version).jar -console
- cd glassfish
- ant -f setup.xml
- ./bin/asadmin start-domain
Wait for 1min for glassfish and liferay to initialize.
Access Portal at http://localhost:8080/portal The first request will take a while to respond since JSPs are compiled.
Troubleshooting missing ant#
If step 4 complains about ant not existing you may use the bundled version. Replace step 4 with:
4.1. chmod -R +x lib/ant/bin/ant 4.2. lib/ant/bin/ant -f setup.xml
Troubleshooting log4j dependency#
When using Liferay 4.4.2 and possibly others. (This is not a problem with Liferay 5.1.1) If the above instructions don't work (after waiting a minute or so), check domains/domain1/logs/server.log for an entry similar to
[#|*|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|*|WebModulePWC1270: Exception starting filter Secure MainServlet Filter **java.lang.NoClassDefFoundError: //org/apache/log4j/Logger**//'//****//
A Simple workaround is:
- Download log4j.jar (version 1.2) https://lportal.svn.sourceforge.net/svnroot/lportal/portal/trunk/lib/portal/log4j.jar to glassfish/domains/domain1/lib
- Restart the glassfish domain
- [Base-Dir]/glassfish/bin/asadmin stop-domain
- [Base-Dir]/glassfish/bin/asadmin start-domain
Use MySQL as the portal database #
- Make sure Glassfish is running
- Open http://localhost:4848/ in your browser, and log in as username : admin, password : adminadmin
- In the menu in the left, choose "Common Tasks->Resources->JDBC->Connection Pools->LiferayPool"
- Change "Datasource Classname:" from "org.hsqldb.jdbc.jdbcDataSource" to "com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource".
- Change "Resource Type:" from "javax.sql.DataSource" to "javax.sql.ConnectionPoolDataSource"
- Click "Save"
- Go to the "Additional Properties" tab in the same screen, and change username from "sa" to "lportal", and password from "" to "lportal"
- Delete property "database".
- Add properties "databaseName" with value "lportal", "serverName" with value "localhost", and "port" with value "3306"
- Click "Save"
- Possibly also add the following properties useUnicode=true, characterEncoding=UTF-8, useFastDateParsing=false
- Stop the GlassFish server, and then start it again. (I am not sure if this is needed, or if there is some way to have GlassFish only restart the Liferay web applications.)
- bin/asadmin stop-domain
- bin/asadmin start-domain
- Open http://localhost:8080/ in your browser, and you should see Liferay running off MySQL portal database
Known Issues #
- On Mac port of JDK 1.6 does not work
Please use JDK 1.5.x on Mac.
I was able to run setup using SoyLatte by editing setup.xml. SoyLatte returns Darwin as the OS Name, so if you change <os name="Mac OS X"/> for <os name="Darwin"/>, the setup works. After the succesful setup with SoyLatte, the portal seems to run just fine. So, for now, if you want to use JDK 1.6, SoyLatte is the option.
- Accessing http://localhost:8080/portal does not bring up Liferay portal.
First Access takes some time. Maybe a minute to respond. This is because the process is busy compiling the JSPs, loading the database schema and data. This may be a memory issue, especially if you are using JDK 1.5. Try accessing the URL again - it took me a couple of tries for it to work.
- java.io.FileNotFoundException: /Users/user1/.asadmintruststore (Permission denied) when running ant -f setup.xml fails.
I believe NetBeans 6 installed this file as root and I was installing as a non-root user. I used the sudo command to install as root to workaround this problem
- Mac - library issue (5.1.1)
java.lang.NoSuchMethodError: org.apache.xml.utils.DefaultErrorHandler.<init>(Z)V at org.apache.xalan.processor.TransformerFactoryImpl.<init>(TransformerFactoryImpl.java:1002
Copy the following JAR files
from glassfish/domains/domain1/applications/j2ee-modules/liferay-portal/WEB-INF/lib/ to glassfish/domains/domain1/lib/
Thanks to Virgilio, from the forums https://support.liferay.com/web/guest/community/forums/-/message_boards/message/1295953.
Install Liferay Manually on Glassfish V2#
- Create a directory into which to store and extract the download files (e.g. C:\Liferay).
- Go to http://www.liferay.com/web/guest/downloads/additional.
- Download the Liferay Portal 4.X.Y WAR file for Servlet 2.4 to the directory (e.g. C:\Liferay).
- Download the Liferay Portal 4.X.Y Dependencies file and unzip to the dependencies subdirectory (e.g. C:\Liferay\dependencies).
- Download the Liferay Portal 4.X.Y SQL Scripts file and unzip to the sql subdirectory (e.g. C:\Liferay\sql).
- Download the Liferay Plugins SDK 4.X.Y file and unzip to the sdk subdirectory (e.g. C:\Liferay\sdk).
- Download the Liferay Portal 4.X.Y Web Services Client and unzip to the ws-client subdirectory (e.g. C:\Liferay\ws-client).
- Download the Liferay Portal 4.X.Y JavaDocs and unzip to the doc subdirectory (e.g. C:\Liferay\doc).
- Login as the administrator to the database of your choice.
- Select either the minimal installation (scripts in the sql/create-minimal subdirectory) or the full example installation (scripts in the sql/create subdirectory) and run the script for your database server (e.g. create-mysql.sql). The default database created by the script is called lportal.
- Recommended security: Create a separate Liferay database user and grant it SELECT, INSERT, UPDATE, and DELETE permissions on all tables in the lportal database.
- Stop Glassfish if it is running.
- Copy the Liferay dependencies to the Glassfish domains/<liferay_domain>/lib subdirectory.
- Copy the xercesImpl.jar file from the Liferay sdk/lib subdirectory to the Glassfish domains/<liferay_domain>/lib subdirectory.
- Copy any required bridges (e.g. jsf-portlet.jar) to the Glassfish domains/<liferay_domain>/lib subdirectory.
- Copy the JDBC driver for your database to the domains/<liferay_domain>/lib directory.
- Start Glassfish and login to the Admin Console.
- Go to Resources/JDBC/Connection Pools and create a connection pool to connect to the lportal database.
- Go to Resources/JDBC/JDBC Resources, create a JDBC resource with the name jdbc/LiferayPool, and associate it with the connection pool created in the previous step.
- Go to Resources/JavaMail Sessions and create a JavaMail resource with the name mail/MailSession.
- Deploy the Liferay WAR file to the server with the context root /.
- If the application server is running locally, set the upload option to false (if using the asadmin command-line tool) or use the Local packaged file or directory that is accessible from the Application Server option in the Admin Console.
- For faster application load times, precompile the JSPs (this will take several minutes).
- Do not run the verifier, as the sun-web.xml file does not match its DTD and will cause a deployment failure.
- Go to the Liferay portal (http://localhost:8080/ if running locally under Glassfish).
- Sign in as the administrator (email@example.com).
- Add the “Plugin Installer” portlet if not present.
- Go to the “Configuration” tab of the “Plugin Installer”.
- Change the “Deploy Directory” to the deployment directory of your choice.
- Press “Save”.