Building and Installing Liferay Source Code on GlassfishV2

GlassfishLiferayI came across various articles to deploy liferay on glassfish. Thanks to them I could figure out the exact way on how to do it. Here is a step by step procedure which I tested twice and it works. If it does not work for you , let me know.

Here are the steps: 

  1. Download Glassfishv2(b58g). Install it
    • java -Xmx256m -jar glassfish-installer-v2-b58g.jar
    • ant -f setup.xml
  2. Download mySQL and mySQL connector jar.
  3. Install mySQL (Refer installation specifics below in Notes section)
  4. Create database 'lportal' with user 'lportal' and grant system/administrator level privileges. This is a sample default user. One can create other users and try it out by modifying Liferay Source Code. For Details refer mySQL Documentation
  5. Alternatively, follow these steps
    1. Login to mysql as 'root' and create database lportal;
    2. use lportal;
    3. create user lportal;
    4. set password for 'lportal'@'localhost' = password('lportal');grant all privileges on \*.\* to 'lportal'@'localhost' identified by 'lportal'
  6. 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.
    • While doing so, one can specify the database to connect to.
    • 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.
    • Stop Glassfish
  7. Download Liferay Source Code. Unzip it
  8. Download apache-ant-1.7.0. Extract it
  9. set ANT_HOME to apache-ant-1.7.0
  10. Use JDK 1.5 or above and set it in Path.
  11. Go to Liferay source code directory and modify appserver.properties. Make sure you specify the directory in which glassfish is installed and NOT the glassfish home. For example, if glassfish is installed in f:\\glassfish, then in the app.server.properties, please specify f:/(forward slash on Windows). The name of the glassfish folder has to be "glassfish". Comment tomcat entry :-)
  12. In app.server.properties , please specify the glassfish version viz. v2 or v3. Please change it to reflect as per the glassfish download that one has.
  13. Go to Liferay Source Code Directory and run ant -f build.xml all
  14. Once, build is successful, the build process will create the necessary jars and copy them to Glassfish Domain.
  15. Copy mysql connector jar in the glassfish/domains//lib
  16. Restart Glassfish. Wait for 3 minutes, since Liferay compiles JSPs. One can turn off JSP Compilation if required.

Hope this helps!!! Please try it out and let me know if we need to modify these steps anywhere.

 Start using Liferay with Glassfish!!!

Note:

  1.  The build might delete the existing glassfish domains directory and create a new one. Hence, do take necessary backup. These installation steps are on a fresh glassfish installation.
  2. The build might fail due to some minor Java errors. One might have to modify them and then run the build. I observed one such error.
  3. For those who want to get quick started without getting their hands dirty,but want to do it with Glassfish, there is also a Liferay bundle with Glassfish available for download here
  4. Install mySQL with detailed configuration. That way one will have better control especially multilingual etc./firewall blocking/unblocking
  5. If you have tried an unsuccesfull install of mySQL and unable to install again, please uninstall, delete the MYSQL installation directory and re-install MYSQL
  6. When MySQL is successfully installed, log on as "root" and create user lportal with lportal(password) and grant privileges.
  7. If you intend to create connection pool faster, you may follow alternatively the below method:
    1. Create mysql_liferay_connection_pool.xml
    2. Add the following contents to it
    3. <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE resources PUBLIC
      "-//Sun Microsystems Inc.//DTD Application Server 9.1 Domain//EN"
      "\\\*[http://www.sun.com/software/appserver/dtds/sun-resources_1_2.dtd\*]"> <resources>
          <jdbc-connection-pool
              name="LiferayPool"
              datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
              res-type="javax.sql.DataSource">
              <property name="user" value="lportal"/>
              <property name="password" value="lportal"/>
              <property name="url" value="jdbc:mysql://localhost:3306/lportal"/>
          </jdbc-connection-pool>
          <jdbc-resource
              enabled="true"
              jndi-name="jdbc/LiferayPool"
              object-type="user"
              pool-name="LiferayPool"/>
      </resources>
    4. Now run following command in glassfish/bin directory:
      asadmin add-resources <location-of-resource-file>/mysql_liferay_connection_pool.xml
Comments:

Hey Vihang,
Thanks for the post. I had been looking forward to build the source code of Liferay, and this provides a detailed step-by-step approach. Will let you know if I can get it working ;)

-Karthik

Posted by Karthik on February 25, 2008 at 04:15 AM IST #

It may be worth pointing out that there aer ready-to-go builds of Liferay with GlassFish at the Liferay download site. The latest is at [1]

[1]http://sourceforge.net/project/showfiles.php?group_id=49260&package_id=42607

Posted by Eduardo Pelegri-Llopart on February 25, 2008 at 01:03 PM IST #

How do you set it up so it finds jdbc/Liferaypool for mySQL?

-Glenn

Posted by Glenn Espina on March 03, 2008 at 07:22 PM IST #

# 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.
While doing so, one can specify the database to connect to.
# 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.

Posted by Vihang Pathak on March 04, 2008 at 01:38 AM IST #

Hi Eduardo,

I have updated the blog. See Note 3

Thanks,
Vihang

Posted by Vihang Pathak on March 04, 2008 at 01:44 AM IST #

Thanks Vihang. This was very helpful. In #13 add a link to the connector jar.

Posted by Deepak Gothe on March 27, 2008 at 04:28 PM IST #

Thanks for the blog. Only one change :

Step no 4 :
set password for 'lportal'@'localhost' = password('lportal');grant all privileges on \*.\* to 'lportal'@'localhost' identified by 'lportal'

The grant all privileges step should be run before set password.

Posted by siddesh on September 17, 2008 at 02:57 PM IST #

Hi please suggest me how to take backup in life ray.
i want to take backup of library document of particular directory.
how it is possible ?
where the files will store in server?
please help me in this.

thanks,
KIran

Posted by kiran on October 06, 2008 at 11:58 AM IST #

hi any one idea about life ray
please suggest how to take backu up from document library for particular folder
please help me

Posted by kiran on October 06, 2008 at 12:03 PM IST #

One of the first things that you should bear in mind when setting up an online business of any sort, is that you must treat it as just that – a business. This means that you must be prepared to put in the time and effort in order to reap the rewards, even if you are only starting it as a part time venture at first. However, the best place to begin is by picking what you like from the existing successful online business models already out there. So talk to others who have already made money in the niche that you have chosen, and then study, then implement the steps that they took to make it the success it is. So now you need to think about just what sort of business it is you like to run. Some of the more popular types of online businesses to be found are: selling goods at auction sites such as Ebay, creating and then selling digital products (e-books are a good example of this) and setting up a custom storefront for your offline business.
---------------------
nljon10

http://www.widecircles.com

Posted by nljon10 on December 02, 2008 at 04:22 AM IST #

Thanks Vihang. This was very helpful

Posted by Harikrishnan R on May 04, 2009 at 09:17 AM IST #

Hey Vihang,

I don't know if you can help me. I want to modify the existing shopping portlet. Whats ist the best way to modify the shopping portlet in Netbeans and then deploy it to Glassfish, when Liferay/Webspace is alreday installed there.

Thanks

Posted by Dennis on June 03, 2009 at 11:20 AM IST #

Hi Dennis,

There is a new development in Liferay known as hooks in the plugin environment.
Using this you can create jsp hooks, event hooks for any existing application within Liferay.

NetBeans PortalPack has support for hooks development(portalpack.netbeans.org). This should probably address your requirement.

-Vihang

Posted by Vihang on June 03, 2009 at 02:46 PM IST #

Hey Vihang, thanks for your help. If I got that right, a hook is just a certain part of whole source code, which can be modified, correct? As far as I can see it, with a hook you can only modify for example the JSP but you can not add or remove certain function, right? So I went on and tried to deploy the whole source code with netbeans to GFv2. But it didn't work. Is it difficult to import the source code to NB and deploay it to an empty GFv2 instance? Is there a howto for doing this? Thanks in advance!

Posted by Dennis on June 04, 2009 at 02:54 PM IST #

Hi Dennis,
Glad that you tried it out.

See this blog for more details on hooks.

http://www.liferay.com/web/rauge/blog/-/blogs/portal-hook-plugins

Secondly there is a blog here(http://www.liferay.com/web/chetan/blog/-/blogs/2580490) on how to use the hooks plugin in NetBeans

Hope this helps!!!

Posted by guest on June 04, 2009 at 03:55 PM IST #

hi friends,
m getting errror at the time of creating a user in the portal database,error code is 1064(42000)sysntax error;
i m use
create user iportal;
please reply as soon as possible..!!

Posted by Pankaj on April 12, 2010 at 10:52 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

vihangpathak

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