Wednesday, December 1, 2010

Deploying Alfresco Share portlets in Liferay

In Web Scripts as Portlets tutorials, how to deploy Alfresco Web Scripts as Liferay Portlets have been discussed. In this tutorial we will see how to deploy Alfresco Share 3.4 portlets in Liferay.

In the latest community release 3.4b, Alfresco has come up with three new portlets as part of the Share distribution.
  1. Repository Browser
  2. Site Document Library
  3. My Document Library
These are more popularly called as Share DocLib portlets.

Some of the important capabilities of these portlets are -
  • Create Content, Create Folder, Upload
  • Navigate Breadcrumbs, RSS Feed, Hide/Show Folders
  • Simple/Detailed View
  • Filters - All Documents/I'm Editing/Others are Editing/Recently Modified, Recently Added, My Favorites
  • Hierarchical folder browsing
  • Tag browsing
  • Simple Document Details Page
  • Document Details Page including all existing standard Document Actions, Version history, Commenting
  • Edit Document Metadata
  • Simple Folder Details Page (Popup)
  • Folder Details Page - All existing standard folder actions
  • Edit Folder Metadata
In this tutorial, we will explore the steps to deploy these portlets in Liferay.
This is what it would look like.


  • Liferay 5.2.3
  • Alfresco 3.4b
  • Tomcat 6.0.18
  • MySQL 5
  • Windows 7
  • JDK 6


Assuming you have Tomcat bundle of Liferay up and running (you can download from here), download Alfresco 3.4 packages.


  1. Unzip the downloaded alfresco 3.4 bundle, three folders will be there - bin, licenses and web-server.
  2. Copy the contents of bin folder in \tomcat-6.0.18\bin folder.
  3. Copy the contents of licenses folder in the license folder .
  4. Copy the files of web-server\endorsed folder in \tomcat-6.0.18\endorsed folder. You can create the folder in case it does not exist.
  5. Copy of the files of web-server\lib folder in \tomcat-6.0.18\lib folder.
  6. Copy the contents of web-server\shared folder in \tomcat-6.0.18\shared folder. Create the shared folder if it does not exist.
  7. Create a database in your local MySQL server named alfresco. Create a user named alfresco with same password; and give the user all permissions to the new database.
  8. Open the file from \tomcat-6.0.18\conf folder in your text editor; and put the value of shared.loader as ${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar
    The line should look like
  9. Copy the web-server\webapps\alfresco.war file in tomcat's webapps folder - \tomcat-6.0.18\webapps folder.
  10. Now start your tomcat server (we haven't deployed share yet) . The server might take a few minutes to start up. Both liferay and alfresco should be deployed. The bootstrap should create tables required for alfresco to run in your MySQL database. Once the server is up and running, you can access Liferay portal as well as Alfresco Web Client application in your browser.
  11. Now copy the web-server\webapps\alfresco.war file in your liferay's deploy folder. This should ideally be located in parallel to your tomcat-6.0.18 folder.
  12. In the tomcat server log, you will be able to see that the share application is being deployed in the server.
    Notice the following log information properly appeared. This means your share portlets have been recognized and deployed by liferay.
    INFO [PortletHotDeployListener:227] Registering portlets for share
    INFO [PortletHotDeployListener:351] 3 portlets for share are available for use
  13. Once the deployment is done, we are just a few steps away. We need to configure the permission model of the alfresco and share application - so that the portlets can properly run in liferay. Stop the tomcat server.
  14. Rename the file as (in folder \tomcat-6.0.18\shared\classes); and open the file. Append the following two lines at the end of the file.

  15. Then open the share-config-custom.xml file from\tomcat-6.0.18\shared\classes\alfresco\web-extension folder, and append the following lines

    <!-- Overriding endpoints to reference a remote Alfresco server -->
    <config evaluator="string-compare" condition="Remote">

    <name>Alfresco - unauthenticated access</name>
    <description>Access to Alfresco Repository WebScripts that do not require authentication</description>

    <name>Alfresco Feed</name>
    <description>Alfresco Feed - supports basic HTTP authentication</description>

    <name>Alfresco Connector</name>
    <description>Connects to an Alfresco instance using cookie-based authentication</description> <class>org.springframework.extensions.webscripts.connector.AlfrescoConnector</class>

    <name>Alfresco - user access</name>
    <description>Access to Alfresco Repository WebScripts that require user authentication</description>


  16. Restart your tomcat server, once the server is up, open Liferay portal, log in as Administrator, try to add new portlet. In the available portlet list, you will be able to see a new group named Alfresco and three portlets available there.

You can add any of the portlets from here and test the functionalities. You have got the full alfresco share document library features in your portal!