Krishnamohan Meduri's weblog

Wednesday Feb 06, 2008

Run Liferay Portal on Sun Java System Web Server 7 Update 2

Run Liferay Portal on Sun Java System Web Server Here are the steps to run Liferay Portal on Sun Java System Web Server 7.0 Update 2. Let me divide the steps into 3 parts. First you need to download several Liferay bundles and unzip them. Then, you need to setup your Database Server. Then, you have to configure Web Server for running Liferay Portal

Prerequisites

1. Create a directory say C:\Liferay (or /home/userid/Liferay).
2. Go to http://www.liferay.com/web/guest/downloads/additional and download

  • "Liferay Portal 4.4.0 WAR (Servlet 2.4)" file to say C:\Liferay.
  • "Liferay Portal 4.4.0 Dependencies" file and unzip to say, C:\Liferay\dependencies.
  • "Liferay Portal 4.4.0 SQL Scripts" file and unzip to say, C:\Liferay\sql.
  • "Liferay Plugins SDK 4.4.0" file and unzip to say, C:\Liferay\sdk.
  • optionally other files like Java documentation etc.
3. Have the JDBC driver ready for your database server.
For this blog, I downloaded MySQL JDBC driver from http://dev.mysql.com/downloads/connector/j/5.1.html and used mysql-connector-java-5.1.5-bin.jar.
4. Download Java Transaction API classes (jta-1_1-classes.zip) from http://java.sun.com/products/jta/
5. Have "Java Message Service API classes" (jms.jar) ready.
(Note: I could not find any link to download "Java Message Service API classes". However I found jms.jar in liferay-portal-tomcat-5.5-jdk5-4.4.0 installation that I got from  http://www.liferay.com/web/guest/downloads/portal. I also found these classes in javaee.jar in glasfish.)

Database Setup

1. Login as administrator into your Database Server
2. Any of create-minimal-*.sql scripts in the C:\Liferay\sql\create directory drops and creates database named lportal, creates all necessary tables and indexes and loads the minimal necessary data. create-*.sql does the same and additionally loads example data. Select either of them suitable for your database server (e.g. create-mysql.sql) and run the script.

mysql>source create-mysql.sql

Note: Preferably create a separate database user and grant it SELECT, INSERT, UPDATE, and DELETE permissions on all tables in the lportal database.

Sun Web Server configuration

1. Stop the Web Server instance if it is running.
https-<config>\bin\stopserv

2. Copy the following list of JAR/Zip files to the Web Server's https-<config>\lib (Create lib directory if it does not exist).
  • JAR files files under C:\Liferay\dependencies\liferay-portal-dependencies-4.4.0
  • xercesImpl.jar file under C:\Liferay\sdk\lib
  • JDBC driver for your database
  • jta-1_1-classes.zip
  • jms.jar
    Note: I will refer to Web Server's https-<config> directory as <instance-dir> in this blog.

3. Start Web Server's Administration Server and make required changes to the configuration using Administration CLI wadm.
  • Start Administration server
admin-server\bin\startserv
  • Log into wadm as administrator
  • List available configurations and choose one. Following commands assume <config> as the configuration.
wadm> list-configs
  • Create a mail resource with the JNDI name mail/MailSession
wadm> create-mail-resource --config=<config> mail/MailSession
  • Create a JDBC resource with the JNDI name jdbc/LiferayPool. (Note: In below command, replace MySQL datasource class wth the datasource class for your database)
wadm> create-jdbc-resource --config=<config> --datasource-class=com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource jdbc/LiferayPool
  • Set JDBC resource user properties viz. user, password, url for the JDBC resource (Note: In below command, replace MySQL url with the url for your database)
wadm> create-jdbc-resource-userprop --config=<config> --jndi-name=jdbc/LiferayPool user=<user> password=<password> url="jdbc:mysql://localhost/lportal"
  • Enable connection validation
wadm> set-jdbc-resource-prop --config=<config> --jndi-name=jdbc/LiferayPool connection-validation-table-name=<config> connection-validation=table
  • Deploy the liferay web application and make it the default web application for the instance. Here you have an option not to precompile JSP pages.
a) If you choose to precompile, it may take 15-20 minutes (depending on machine configuration) to precompile 600+ JSP pages of Liferay application but the application loading and response time will be faster.

To deploy with the precompile option,

wadm> set-jvm-prop --config=<config> class-path-suffix=<instance-dir>/lib/jms.jar; \
<instance-dir>/lib/jta-1_1-classes.zip;<instance-dir>/lib/xercesImpl.jar; \
<instance-dir>/lib/portal-kernel.jar;<instance-dir>/lib/portal-service.jar; \
<instance-dir>/lib/portlet.jar;<instance-dir>/lib/<jdbc-driver-jar>

wadm> add-webapp --config=<config> --vs=<config> --uri=/ --precompile-jsp liferay-portal-4.4.0.war

b) If you don't precompile, the deploy is quick but the application loading and response time will be slow.

To deploy without precompile option,

wadm> add-webapp --config=<config> --vs=<config> --uri=/ liferay-portal-4.4.0.war
  • Deploy the configuration changes. This also may take time.
wadm> deploy-config <config>

4. Start the Web Server instance
https-<config>\bin\startserv

In your browser, Go to http://localhost:8080 if you are running the instance locally.

Comments:

Great. Are there any advantages or disadvantages of running Liferay on Sun Web Server?

Posted by 192.18.120.198 on February 07, 2008 at 01:26 PM PST #

Sun Web Server was holding a world record for its performance. The merit I can think of is one can take advantage of Sun Web Server's high scalability and performance.

Posted by 192.18.121.3 on February 07, 2008 at 02:16 PM PST #

hi
I was build my own Mysql database on my computer using Java(JDBC) how can I display this database on website I mean if I design a website can i make it connect it to my computer and make it get the database. or can i connect to Mysql server and make update?
please help me.
thank you.

Posted by Mohammed F. on September 01, 2008 at 08:03 AM PDT #

While deploying, the jsps fail to compile. It does not find classes from portal-kernel.jar . I have put the .jars in class-path-suffix as explained - still no luck

Posted by Muhammed Shakir on April 12, 2009 at 02:32 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Calendar

Feeds

Search

Links

Navigation

Referrers