Sunday, April 5, 2015

Working with Expando API in Liferay

Liferay have introduced Expando API to extending existed Liferay tables to add additional columns rather than creating new tables in the database.

Logically its look like new tables in Liferay but originally it won’t be created in the Liferay database.

All Expando mechanism is organized by following four tables which are already created in the Liferay database.

ExpandoTable

This will manage the brand new table information its means virtual tables information

ExpandoColumn

It manages the columns information related to respective Expando table.

ExpandoRow

It will used to manage table rows related to respective Expando table

ExpandoValue

 Originally data will be stored in this table and it will mapped with Expando table and Expando row.

From above four tables we can create many tables logically and which act like original tables in database.

Advantages:

We can extend existed Liferay tables

Liferay have implemented custom fields for User, Site, Role and Organization it will use the Expando mechanism to create additional fields so that it will be extending the original User_, Role_, Organization_ and Group_ tables.


We can Logically Create brand new tables and columns

We can also create new tables and columns in our real time requirement and when we created tables and columns using Expando we don’t need to write any service layer implementation to data storage and retrieval and with help of Expando API classes we can store and retrieve data.

Best example for above is Webform Portlet. This will use Expando API to create brand new tables and columns to each form based on fields we have created for webform.

The data will be managed in brand new Expando table here for each form they will created tables and all form data will be stored in the respective Expando table.

Brand new table information available in ExpandoTable,

All columns information ExapndoColumn with mapping of Expando Table Id

For each form submission it will create new row in ExpandoRow table

Form data will be stored in ExpnadoValue and here for each input field data will create new record in ExpnadoValue table and stored with reference ids like ExpandoRow Id.

Liferay Expando API Implementation Example

Assume we are going to create employee form and employee consists of different fields.
Now we will use Expando API to store employee information and display in Portlet.

Employee Form Fields


First Name,
Last Name
Employee Designation
Email Address
Age
Phone Number


The following is Required Expando Artifacts in Implementation

Expando Table Name: Employee

Expando Columns

Column Name
Type
First Name,
String
Last Name
String
Employee Designation
String
Email Address
String
Age
Integer
Phone Number
String

Required Steps in Implementation

Need to create Expando Table and Name is Employee

Need to create Expando Columns for Employee with reference of Expando Table Id

Need to store data in Expando Value table with reference of Table Id, Expando Row Id

Note:

We need to remember that Expando Tables and Its columns only for one time creation and each employee form submission we will create ExpandoRow and Add values in ExpandoValue Table. For each filed in Employee form we will create new ExpandoValue record and store field data in it.

Here we need not to create ExpandoRow explicitly for each employee form submission, at the time of add values in ExpandoValue table rows will be crated automatically in ExpandoRow Table.

The following are Expando API classes we will use in Code Implementation


From above classed we will use different API methods and the following are some of important method signatures


ExpandoTableLocalServiceUtil.addTable(companyId, XXXX.class.getName(), tableName);

ExpandoColumnLocalServiceUtil.addColumn(tableId,fieldName,ExpandoColumnConstants.STRING);

ExpandoColumnLocalServiceUtil.addColumn(tableId,fieldName,ExpandoColumnConstants.Integer);

ExpandoValueLocalServiceUtil.addValue(
companyId, XXXX.class.getName(), databaseTableName,
fieldLabel, classPK, fieldValue);



ExpandoColumnConstants provide values for column types  such as int, long, String, long, double and Boolean.

Note:

ClassPK is kind of primary key we can generate as follows


long classPK = CounterLocalServiceUtil.increment(XXXX.class.getName());
OR
long classPK = CounterLocalServiceUtil.increment();


Database Reference for Expando API



Expando API Example Portlet View Page



Expando API Example Portlet Add Employee Page



Expando API Example Portlet Display Employees Page


Download Liferay Expando API Example Portlet


Complete Code Example

view.jsp (/html/jsps/view.jsp)


<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects />
<liferay-theme:defineObjects />
<h1>Liferay Expando API  Example</h1>
<portlet:renderURL var="addEmployee">
<portlet:param name="mvcPath" value="/html/jsps/add_employee.jsp"/>
</portlet:renderURL>
<portlet:renderURL var="dislayEmployees">
<portlet:param name="mvcPath" value="/html/jsps/display_employeed.jsp"/>
</portlet:renderURL>

<br/>
<a href="<%=addEmployee.toString()%>">Add Employee</a><br/>
<a href="<%=dislayEmployees.toString()%>">Display Employees</a><br/>


add_employee.jsp  (/html/jsps/add_employee.jsp)


<%@page import="com.liferay.portal.kernel.servlet.SessionErrors"%>
<%@page import="com.liferay.portal.kernel.servlet.SessionMessages"%>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>

<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects />
<portlet:renderURL var="homeURL"></portlet:renderURL>
<portlet:actionURL var="addEmployeeActionURL" windowState="normal"
name="addEmployee">
</portlet:actionURL>
<% if(SessionMessages.contains(renderRequest.
getPortletSession(),"employee-add-success")){%>
<liferay-ui:success key="employee-add-success" message="Employee information
have been added successfully." />
<%} %>
<% if(SessionErrors.contains(renderRequest.getPortletSession(),
"employee-add-error")){%>
<liferay-ui:error key="employee-add-error" message="There is an
Error occured while adding employee and please try again" />
<%} %>
<h2>Add Employee</h2>
<a href="<%=homeURL.toString() %>">Home</a><br/><br/>
<form action="<%=addEmployeeActionURL%>" name="employeeForm"  method="POST">
<b>First Name</b><br/>
<input  type="text" name="<portlet:namespace/>employeeFirstName" id="<portlet:namespace/>employeeFirstName"/><br/>
<b>Last Name</b><br/>
<input type="text" name="<portlet:namespace/>employeeLastName" id="<portlet:namespace/>employeeLastName"/><br/>
<b>Employee Designation</b><br/>
<input type="text" name="<portlet:namespace/>employeeDesignation" id="<portlet:namespace/>employeeDesignation"/><br/>
<b>Email Address</b><br/>
<input type="text" name="<portlet:namespace/>emailAddress" id="<portlet:namespace/>emailAddress"/><br/>
<b>Age</b><br/>
<input type="text" name="<portlet:namespace/>employeeAge" id="<portlet:namespace/>employeeAge"/><br/>
<b>Phone Number</b><br/>
<input type="text" name="<portlet:namespace/>phoneNumber" id="<portlet:namespace/>phoneNumber"/><br/>
<input type="submit" name="addStudent" id="addStudent" value="Add Employee"/>
</form>


display_employeed.jsp  (/html/jsps/display_employeed.jsp)


<%@page import="com.liferay.portlet.expando.NoSuchTableException"%>
<%@page import="com.liferay.portlet.expando.model.ExpandoTable"%>
<%@page import="com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil"%>
<%@page import="com.liferay.portal.kernel.util.StringPool"%>
<%@page import="com.liferay.portlet.expando.service.ExpandoValueLocalServiceUtil"%>
<%@page import="com.liferay.portlet.expando.model.ExpandoRow"%>
<%@page import="com.liferay.portal.kernel.dao.orm.QueryUtil"%>
<%@page import="com.meera.liferay.expandoapi.LiferayExpandoAPIAction"%>
<%@page import="java.util.List"%>
<%@page import="com.liferay.portlet.expando.service.ExpandoRowLocalServiceUtil"%>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects />
<liferay-theme:defineObjects />
<portlet:renderURL var="homeURL"></portlet:renderURL>
<h1>Liferay Expando API Display Employees</h1>
<a href="<%=homeURL.toString() %>">Home</a><br/><br/>
<table style="width:100%" border="1">
<tr>
<th>FirstName</th>
<th>LastName</th>
<th>Designation</th>
<th>EmailAddress</th>
<th>Age</th>
<th>PhoneNumber</th>
</tr>
<%
ExpandoTable expandoTable=null;
String message=null;
try {
expandoTable = ExpandoTableLocalServiceUtil.getTable(
themeDisplay.getCompanyId(), LiferayExpandoAPIAction.class.getName(),LiferayExpandoAPIAction.expandoTableName);
}
catch (NoSuchTableException nste) {
message="Table  not existed to show the data. please add data first and comeback to to see the data";
}

if(expandoTable!=null){
List<ExpandoRow> rows = ExpandoRowLocalServiceUtil.getRows(
themeDisplay.getCompanyId(), LiferayExpandoAPIAction.class.getName(),
LiferayExpandoAPIAction.expandoTableName, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
for (ExpandoRow row : rows) {
String data = ExpandoValueLocalServiceUtil.getData(
themeDisplay.getCompanyId(),
LiferayExpandoAPIAction.class.getName(), LiferayExpandoAPIAction.expandoTableName,
LiferayExpandoAPIAction.columnNames[0], row.getClassPK(), StringPool.BLANK);

%>
<tr>
<td><%=ExpandoValueLocalServiceUtil.getData(
themeDisplay.getCompanyId(),
LiferayExpandoAPIAction.class.getName(), LiferayExpandoAPIAction.expandoTableName,
LiferayExpandoAPIAction.columnNames[0], row.getClassPK(), StringPool.BLANK) %></td>

<td><%=ExpandoValueLocalServiceUtil.getData(
themeDisplay.getCompanyId(),
LiferayExpandoAPIAction.class.getName(), LiferayExpandoAPIAction.expandoTableName,
LiferayExpandoAPIAction.columnNames[1], row.getClassPK(), StringPool.BLANK) %></td>
<td><%=ExpandoValueLocalServiceUtil.getData(
themeDisplay.getCompanyId(),
LiferayExpandoAPIAction.class.getName(), LiferayExpandoAPIAction.expandoTableName,
LiferayExpandoAPIAction.columnNames[2], row.getClassPK(), StringPool.BLANK) %></td>
<td><%=ExpandoValueLocalServiceUtil.getData(
themeDisplay.getCompanyId(),
LiferayExpandoAPIAction.class.getName(), LiferayExpandoAPIAction.expandoTableName,
LiferayExpandoAPIAction.columnNames[3], row.getClassPK(), StringPool.BLANK) %></td>
<td><%=ExpandoValueLocalServiceUtil.getData(
themeDisplay.getCompanyId(),
LiferayExpandoAPIAction.class.getName(), LiferayExpandoAPIAction.expandoTableName,
LiferayExpandoAPIAction.columnNames[4], row.getClassPK(), 0) %></td>
<td><%=ExpandoValueLocalServiceUtil.getData(
themeDisplay.getCompanyId(),
LiferayExpandoAPIAction.class.getName(), LiferayExpandoAPIAction.expandoTableName,
LiferayExpandoAPIAction.columnNames[5], row.getClassPK(), StringPool.BLANK) %></td>
</tr>
<%}}%>
</table>
<h1><%=message!=null?message:StringPool.BLANK%></h1>


LiferayExpandoAPIAction.java


package com.meera.liferay.expandoapi;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import com.liferay.counter.service.CounterLocalServiceUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.servlet.SessionErrors;
import com.liferay.portal.kernel.servlet.SessionMessages;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portlet.expando.NoSuchTableException;
import com.liferay.portlet.expando.model.ExpandoColumnConstants;
import com.liferay.portlet.expando.model.ExpandoTable;
import com.liferay.portlet.expando.service.ExpandoColumnLocalServiceUtil;
import com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil;
import com.liferay.portlet.expando.service.ExpandoValueLocalServiceUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
public class LiferayExpandoAPIAction extends MVCPortlet {
public static String[] columnNames={"FirstName","LastName","Designation","EmailAddress","Age","PhoneNumber"};
public static String expandoTableName="Employee";
private static Log _log = LogFactoryUtil.getLog(LiferayExpandoAPIAction.class);
public void addEmployee(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException, PortletException {
try {
boolean dataAdedSuccess=false;
String firstNameValue = ParamUtil.getString(actionRequest, "employeeFirstName");
String lastNameValue = ParamUtil.getString(actionRequest, "employeeLastName");
String employeeDesignation = ParamUtil.getString(actionRequest, "employeeDesignation");
String emailAddressValue = ParamUtil.getString(actionRequest, "emailAddress");
int employeeAgeValue = ParamUtil.getInteger(actionRequest, "employeeAge");
String phoneNumberValue = ParamUtil.getString(actionRequest, "phoneNumber");
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long companyId=themeDisplay.getCompanyId();

ExpandoTable expandoTable=checkTable(companyId,expandoTableName);
_log.info("expandoTable"+expandoTable.getTableId());
if(expandoTable!=null){
long classPK = CounterLocalServiceUtil.increment(LiferayExpandoAPIAction.class.getName());
ExpandoValueLocalServiceUtil.addValue(companyId, LiferayExpandoAPIAction.class.getName(), expandoTableName,
columnNames[0],classPK, firstNameValue);
ExpandoValueLocalServiceUtil.addValue(companyId, LiferayExpandoAPIAction.class.getName(), expandoTableName,
columnNames[1],classPK, lastNameValue);
ExpandoValueLocalServiceUtil.addValue(companyId, LiferayExpandoAPIAction.class.getName(), expandoTableName,
columnNames[2],classPK, employeeDesignation);
ExpandoValueLocalServiceUtil.addValue(companyId, LiferayExpandoAPIAction.class.getName(), expandoTableName,
columnNames[3],classPK, emailAddressValue);
ExpandoValueLocalServiceUtil.addValue(companyId, LiferayExpandoAPIAction.class.getName(), expandoTableName,
columnNames[4],classPK, employeeAgeValue);
ExpandoValueLocalServiceUtil.addValue(companyId, LiferayExpandoAPIAction.class.getName(), expandoTableName,
columnNames[5],classPK, phoneNumberValue);
dataAdedSuccess=true;
}

if (dataAdedSuccess) {
// adding success message
SessionMessages.add(actionRequest.getPortletSession(),
"employee-add-success");
_log.info("Employee have been added successfylly");
}
// navigate to add student jsp page
actionResponse.setRenderParameter("mvcPath",
"/html/jsps/add_employee.jsp");
} catch (Exception e) {
SessionErrors.add(actionRequest.getPortletSession(),
"employee-add-error");
e.printStackTrace();
}
}

public  ExpandoTable addTable(long companyId, String tableName)
throws PortalException, SystemException {
ExpandoTable expandoTable=ExpandoTableLocalServiceUtil.addTable(
companyId, LiferayExpandoAPIAction.class.getName(), tableName);
_log.error("Expando Table Created Successfully.");
return expandoTable;
}
public  ExpandoTable checkTable(long companyId, String tableName)
throws Exception {

ExpandoTable expandoTable = null;

try {
expandoTable = ExpandoTableLocalServiceUtil.getTable(
companyId, LiferayExpandoAPIAction.class.getName(), tableName);
}
catch (NoSuchTableException nste) {
expandoTable = addTable(companyId, tableName);
for(String columnName:columnNames){
if(columnName.equals("Age")){
ExpandoColumnLocalServiceUtil.addColumn(
expandoTable.getTableId(), columnName,
ExpandoColumnConstants.INTEGER);
}else{
ExpandoColumnLocalServiceUtil.addColumn(
expandoTable.getTableId(), columnName,
ExpandoColumnConstants.STRING);
}

_log.error("Expando Column"+columnName+"Created Successfully.");
}

}
return expandoTable;
}
}

Tuesday, March 10, 2015

Liferay JSON Web services Authenticated Access required

Whenever we are calling Liferay JSON web services we can find Authenticated Access required.
Even we send user name password still we can see the above exception. Generally this kind of exception we can when use apache http client to call Liferay JSON web services.

Generally this exception will encounter due to following reasons
  1. If the Liferay Web services not enable to Guest user Access
  2. When permission checker object is Null
  3. When users not sign in the permission checker  

The following is Liferay portal java class you can find the code



public class AuthenticatedAccessControlPolicy extends BaseAccessControlPolicy {

            @Override
            public void onServiceRemoteAccess(
                                    Method method, Object[] arguments,
                                    AccessControlled accessControlled)
                        throws SecurityException {

                        PermissionChecker permissionChecker =
                                    PermissionThreadLocal.getPermissionChecker();

                        if (!accessControlled.guestAccessEnabled() &&
                                    ((permissionChecker == null) || !permissionChecker.isSignedIn())) {

                                    throw new SecurityException("Authenticated access required");
                        }
            }

}

Even we use Admin User Name and Credentials to access these web services we can see Authenticated Access required.

Solution:

We need to use Basic Authorization heard in the URL request so that we can successfully call the Liferay JSON web services.

We need to set header to httpPost or HttpGet Request so that we can call these web services. When we set Authorization header basic then we need to encode credentials with Base64 encoding format

Example:


Base64 b = new Base64();
String encoding = b.encodeAsString(new String("test@liferay.com:test").getBytes());


Set Basic Authorization header to Http Post/Http Get request as follows


HttpPost post = new HttpPost("/LiferayJSONWebservices-portlet/api/jsonws/employee/get-employee");
Base64 b = new Base64();
String encoding = b.encodeAsString(new String("test@liferay.com:test").getBytes());
post.setHeader("Authorization", "Basic " + encoding);


Consume Liferay Plugin Portlet JSON web services Http Client


package com.meera.liferay;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.BasicHttpContext;
public class LiferayWebserviceClient {
     public static void main(String[] args) throws ClientProtocolException,
     IOException {
     ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
     HttpHost targetHost = new HttpHost("localhost", 8080, "http");
     DefaultHttpClient httpclient = new DefaultHttpClient();
     BasicHttpContext ctx = new BasicHttpContext();
     // Plugin Context Use for Liferay 6.1
     HttpPost post = new HttpPost("/LiferayJSONWebservices-portlet/api/jsonws/employee/get-employee");
     Base64 b = new Base64();
     String encoding = b.encodeAsString(new String("test@liferay.com:test").getBytes());
     post.setHeader("Authorization", "Basic " + encoding);
     List<NameValuePair> params = new ArrayList<NameValuePair>();
     params.add(new BasicNameValuePair("emplyeeId", "30722"));
     UrlEncodedFormEntity entity = new UrlEncodedFormEntity(params, "UTF-8");
     post.setEntity(entity);
     HttpResponse resp = httpclient.execute(targetHost, post, ctx);
     resp.getEntity().writeTo(System.out);
     httpclient.getConnectionManager().shutdown();
     }

}

Consume Liferay Portal Services Using Http Client

package com.meera.liferay;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;

import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.BasicHttpContext;
public class LiferayWebserviceClient {
     public static void main(String[] args) throws ClientProtocolException, IOException {
           HttpHost targetHost = new HttpHost("localhost", 8080, "http");
           DefaultHttpClient httpclient = new DefaultHttpClient();
           BasicHttpContext ctx = new BasicHttpContext();
           // Plugin Context Use for Liferay 6.1
           HttpPost post = new HttpPost("/api/jsonws/country/get-countries");
           Base64 b = new Base64();
        String encoding = b.encodeAsString(new String("test@liferay.com:test").getBytes());
        post.setHeader("Authorization", "Basic " + encoding);
           List<NameValuePair> params = new ArrayList<NameValuePair>();
           //params.add(new BasicNameValuePair("emplyeeId", "30722"));
           UrlEncodedFormEntity entity = new UrlEncodedFormEntity(params, "UTF-8");
           post.setEntity(entity);
           HttpResponse resp = httpclient.execute(targetHost, post, ctx);
           resp.getEntity().writeTo(System.out);
           httpclient.getConnectionManager().shutdown();

     }

}

Required Jar Files


commons-codec.jar
httpclient.jar
httpcore.jar
commons-logging.jar


Download Example and Required Jar files


Tuesday, March 3, 2015

Liferay 7 Installation

Liferay have announced Liferay 7 Community Edition Milestone 4.They have conducted program called Liferay 7 Community Expedition Program so that interested people can join in the program they can test and experience the Liferay 7 portal.

Liferay released liferay-portal-7.0-ce-m4 and we can download portal server bundle and we can explore new featured and we can give feedback to Liferay community so that it will improve the next official release of Liferay 7


The following is download URL for Liferay 7(liferay-portal-7.0-ce-m4)

The following link for Liferay 7 Tomcat Bundle


Liferay 7 Bundle consist following things

Tomcat server with deployed Liferay Portal

Data Directory this folder contains document library and hsql database this is default database for Liferay.

The following screen shows what Liferay Portal Server Bundle contains.



Liferay 7 Unsupported Class Version Error with Java 1.6

When we run this bundle with java 1.6 versions (jdk/jre 1.6) then we will get Unsupported Class Version Error.

Liferay 7 Portal (ROOT) was compiled and packaged with JDK/JRE 1.7 so when we use JAVA 1.6 then we can face Unsupported Class Version Error

Generally when we install Java in our machined we set the JAVA_HOME environment variable so when we start Tomcat Server it will look for JAVA_HOME variable and this will point to our JRE/JDK home directory so that tomcat will use this and start the server successfully.

When we run Liferay Portal 7 and our system have java 1.6 then portal won’t be started and it will give above error.

Solution:

Install JDK 1.7

We need to download JDK1.7 and install into local machine then we need to set JAVA_HOME system environment variable so that we can run Liferay 7 portal.

Download JDK1.7 from following URL


Install JDK then it will be available in C:\Program Files\Java

Set JAVA_HOME environment variables as follows

Variable Name
JAVA_HOME
Value
C:\Program Files\Java\jdk1.7.0_75


Scenario:

Assume we are running some applications and servers in JAVA 1.6 then we don’t want to change JAVA_HOME variable to java 1.7. But we wanted run Liferay 7 portal

This scenario we will use setenv.bat/setenv.sh files which is in Tomcat Server “bin” directory there we will explicitly configure Java 1.7 only for this server so that whenever we start Liferay 7 bundle tomcat server then it will use java 1.7.

Easy Steps:
  1. Download JDK 1.7 and install  
  2. Copy JRE 1.7 and place in Liferay 7 Portal Tomcat server
  3. Open setenv.bat/setenv.sh then set java home

Download JDK 1.7 and install 

Download JDK1.7 from following URL


Install JDK then it will be available in C:\Program Files\Java


Copy JRE 1.7 and place in Liferay 7 Portal Tomcat server

Now copy just jre7 folder from C:\Program Files\Java place this in tomcat server
Create one directory in liferay-portal-7.0-ce-m4\tomcat-7.0.42 say “win” then place jre7 in this newly created directory.




 The following screen shows that JRE7 available in “win” directory


Open setenv.bat/setenv.sh then set java home

Now go to “tomcat-7.0.42\bin” directory open setenv.bat in editor if you are using windows OS otherwise use setenv.sh

Replace the existed content with following content


set "JAVA_HOME=%CATALINA_HOME%/win/jre7"

set "CATALINA_OPTS=%CATALINA_OPTS% -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true  -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"


Finally save the file and start tomcat serve then Liferay portal will start successfully by using jre7.

Launch portal with www.localhost:8080

Complete basic configuration steps and you explore Liferay 7 portal.

Liferay default use there hsql database if you want to change to other database engine create portal-ext.properties file Liferay Home directory then configure database connection details.

Follow the post which is for Liferay 6.2 Installation same you can replicate to Liferay 7.


Liferay 7 Portal Screen


Note:

When we install JDK 1.7 then default java will be latest installed one even we explicitly create JAVA_HOME that point to JAVA1.6.

To make java 1.6 as your default JAVA for your system then go to “C:\Windows\System32” look for java.exe, javaw.exe and javaws.exe files and delete it so that your default java in your machine will be java 1.6 that we set in the JAVA_HOME.

Monday, March 2, 2015

Liferay 7 Community Expedition Program

Liferay recently announced Liferay 7 Community Edition Milestone 4(liferay-portal-7.0-ce-m4). Liferay have given this for testing and add some new ideas to Liferay 7. People who are interested can join in the explorer group so that they can share experiences as feedback and they can post some queries in the discussion forums.

The following is download URL for Liferay 7(liferay-portal-7.0-ce-m4)

The following link for Liferay 7 Tomcat Bundle


Join in Liferay 7 Explorer Group please follow the link


Liferay 7 has added many new features so that we can download bundle, we can explore and we can share our experience with Liferay community so that it will help to improve the Liferay 7.

Many of them already joined in the explorer group people who are interested please can participate and share experience. To join as member there some instruction please follows and become member.

Liferay Feature areas are categorized as follows

Web Experience Management


Collaboration & Productivity


Dev Tooling


Frontend Infrastructure


Interested people can join in this program and then can explore in any of above category and they can share experience and feedback

The following is place to share experience and feedback.




Liferay 7 Portal Screen


Recent Posts

Recent Posts Widget

Popular Posts