Friday Oct 31, 2008

Websynergy on Oracle

1. Downloaded Oracle 10g XE for windows from Install it. I gave SYS/password
2. Access http://localhost:8080/apex -> login as SYS/password
3. Click on Administration -> Database Users -> Create users
Enter username : lportal
password : lportal
Granted all user privileges (except for the DBA checkbox)
4. Go to Oracle sql prompt and run "connect lportal/lportal;" command
5. run the following command "create schema authorization lportal;"

6. Now install websynergy (change the port of websynergy to 6060 in the setup.xml of glassfish so that it doesn't clash with oracle port. ). Start GF V2
7. copy ojdbc14.jar (Download from to glassfish/domains/domain1/lib directory and restart GF V2 again
8. Go to the admin of GF V2 (http://localhost:4848) -> resources -> Connection Pools -> LiferayPool

9. Change to the following properties :
Under "General" Tab :
Datasource Classname : oracle.jdbc.pool.OracleDataSource
Under "Additional Properties" Tab : set the following properties :
username : lportal
password : lportal
URL : jdbc:oracle:thin:@localhost:1521:XE

10. Go to general tab and click on ping. If everything is fine, This should succeed :-)

11. Restart GF V2. This should create the tables and populate all the data into the oracle db.

Monday May 19, 2008

Setting up the development environment on liferay latest trunk

Goals :

1. To setup the dev environment of the liferay code on Netbeans 6.1 and Tomcat in debug mode

This is to understand the liferay code for the project websynergy and the flow of the code. 


 Pre-requisites :

1. Install Netbeans 6.1 , ant 1.7, Tomcat 6.x, and svn



Steps : 

1. checkout the latest Liferay trunk with the help of the following command "svn co liferaytrunk"

2. cd to liferaytrunk

3. run "ant"

4. After this, cd to liferaytrunk copy "" to "". Note : siddesh is the login name for my windows xp machine. So it will vary for you depending on your login name

5. Remove everything from "" and add the following. (Note : These properties might change for you depending on where you have installed the apache-tomcat-6.0.16



6. If one starts the tomcat using startup.bat(in windows) or in Solaris, it gives the following exception

Exception in thread "http-8080-Processor25" java.lang.OutOfMemoryError: PermGen space
Exception in thread "DefaultQuartzScheduler_QuartzSchedulerThread" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-8080-Processor24" java.lang.OutOfMemoryError: PermGen space
Exception in thread "QuartzScheduler_QuartzSchedulerThread" java.lang.OutOfMemoryError: PermGen space
Exception in thread "QuartzScheduler_QuartzScheduler-NON_CLUSTERED_MisfireHandler" java.lang.OutOfMemoryError: PermGen space

7. To solve this, add the following line in catalina.bat(on windows) or solaris) :

JAVA_OPTS="$JAVA_OPTS "-Xmx1024m" "-Xms1024m" "-XX:MaxPermSize=512m""

8. Setting Tomcat to listen in debug mode : (Example of startup.bat is shown)

    cd to apache-tomcat-6.0.16\\bin directory

    Add the following lines in startup.bat script (set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket)

Add the following line just before :end (call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%)

9. Start the netbeans 6.1 and import the liferaytrunk project into the netbeans

10. click on run -> attach debugger

Debugger : JPDA Debugger

Connector : Socket Attach

Host : give localhost or the hostname

Port : 8000

11. Access the liferay http://localhost:8080 This will invoke the debugger in the netbeans 6.1 . One can add break points and checkout the flow of the code.


Sunday May 18, 2008

Configure MYSQL for project websynergy on GlassFish V3 in 60 seconds

Courtesy : Raju uppalapati from the portal team.

Goal : Making websynergy to work with mysql instead of the default hsql database

Pre-requisite :

1. Install WebSynergy

2. Install mysql running on port 3306. Username : root and password :<password>. Create a database "lportal" in it. From the sql command line client, use the command "create database lportal; "



  Accessing websynergy portal :

1. cd to glassfish-synergy/glassfish/bin and run asadmin start-domain

2. Access http://localhost:8585 and login with username:  and password: paul to check whether websynergy is up and running.



 Installing the admin console for the GlassFish V3 :

1. Access http://localhost:8585/admin , Download and install the adminconsole. Login as anonymous. Please go through this blog for more information on installing admin console for Glassfish V3



 Changing the existing jdbc connection pool so that it points to mysql :

1. Follow the following screencast to change the existing jdbc hsql connection pool to point to mysql

2. Restart the domain using "asadmin stop-domain" and "asadmin start-domain" commands

2. Login to websynergy http://localhost:8585. Now it uses mysql to store the user data.



 Also Check Out :

GlassFish Version 3 Community Efforts




HSQL in project websynergy

Goal : To understand the usage of HSQL by project Websynergy

1. Download Websynergy and install it.

2. cd to the glassfish-synergy/glassfish/bin directory and run asadmin start-domain

3. Once the server is started, you will find a lportal.log in glassfish-synergy/glassfish/bin directory

4. This log file contains all the sql statements that are run on the hsql db

5. Now access the websynergy page http://localhost:8585 and login as and password : paul

6. Note the change in the lportal.log. So once paul/paul authenticates, the hsql is updated with paul's information and so is the file lportal.log

Friday May 16, 2008

Creating a custom widget in project websynergy

Courtesy : Thanks to Neel from the Portal team to give me a heads up on this.

Goal : To create a custom widget in the Project websynergy codebase and deploy it in the websynergy portal. Project Websynergy is Sun's next generation portal using Liferay Portal Server, GlassFish v3, and MySQL . I am re-using a JSR 286 portlet which my colleague Sriram has written and can be found here :

Creating a EmployeeInfo Portlet and a Health Portlet which displays the BMI of the person entered in EmployeeInfo Portlet.

Steps to create the widget in websynergy :

 Steps to checkout the websynergy code base :

1. Once the code base is checked out, cd to synergy/widgets directory

2. run ant create . Enter the widget name as "EmployeeInfo" , Enter the widget directory as "EmployeeInfo"

3. The widget directory will have the "EmployeeInfo" directory created which will have src, web and build.xml

4. copy the and under synergy\\widgets\\EmployeeInfo\\src\\java\\com\\sun\\portlet

5. change the package name in and for ex : to "package com.sun.portlet"

6. The EmployeeInfo directory will have "web" directory -> EmployeeInfo-docroot, META-INF and WEB-INF

7. copy the jsp files to WEB-INF/jsp directory

8. add the following lines in the individual jsp files

<%@ taglib uri="" prefix="liferay-portlet" %>
<%@ taglib uri="" prefix="liferay-theme" %>
<%@ taglib uri="" prefix="liferay-ui" %>

9. The purpose of liferay-display.xml and liferay-portlet.xml

a. liferay-portlet.xml is like a wrapper on the portlet.xml. Liferay has added certain extra functionalities and they have used their own dtd (liferay-portlet-app_5_0_0.dtd)

b. The liferay-display.xml has the following items :

<category name="category.sample">
 <portlet id="EmployeeInfo"/>

The category.sample means that when we deploy this portlet and then log in as paul/paul or any other user, then click on "Add application" link, the EmployeeInfo portlet will be displayed under "sample"

10. Add the portlet name in the build.xml in the widgets directory

11. The war file will be created under the directory synergy\\widgets\\EmployeeInfo\\build\\war

12. copy this war file and just paste it under the directory C:\\Documents and Settings\\<username>\\liferay\\deploy

13. Now login to websynergy http://localhost:8585 ( and click on "add applications" . You should find the custom portlets under sample.

Here is how the portlets look on the websynergy :



To checkout the websynergy code base

Project Websynergy is Sun's next generation portal using Liferay Portal Server, GlassFish v3, and MySQL

Steps to checkout the websynergy code base :

1. Download the svn utility from

2. Edit the servers file to add your respective proxy server which is  under the location C:\\Documents and Settings\\<windows user>\\Application Data\\Subversion . A Sample "servers" file is available at the following location. Just replace the tag "<Add your proxy name here>" with your proxy. checkout/servers

3. Note, sometimes the Subversion directory wont be present under C:\\Documents and Settings\\<windows user>\\Application Data until you restart the machine

4. Download and install ant from the location :

5. Download and install JDK 1.6

6. Add a system variable JAVA_HOME = C:\\Program Files\\Java\\jdk1.6.0

7. Add a system variable SVN = C:\\Program Files\\Subversion\\bin\\svn

8. Add the jdk path (C:\\Program Files\\Java\\jdk1.6.0\\bin) to the path variable

9. svn co synergy

10. cd to the synergy directory and run ant

11. Once the ant is successful, cd to the directory synergy\\install\\image\\glassfish\\bin and run asadmin.bat start-domain

12. Wait for 1 or 2 mintues for the jsps to compile and run the websynergy portal by accessing http://localhost:8585  (user : password : paul)





« July 2016