Deploying Alfresco WAR to Liferay

cancel
Showing results for 
Search instead for 
Did you mean: 

Deploying Alfresco WAR to Liferay

luissala
Member II
0 0 1,464
  1. REDIRECT Portlets

InstallationLiferay2.1
This information applies to Alfresco Version 2.1.


How to deploy the Alfresco 2.1+ WAR into Liferay 4.3+


Alfresco 2.1+ features a number of nifty looking AJAX based portlets that can be deployed into Liferay 4.3+. These instructions should be followed to deploy the alfresco.war file from an Alfresco TomCat/WAR 2.1+ download package into an existing Liferay 4.3+ tomcat installation.


  • Create the Alfresco MySQL DB schema in the usual way:

create database alfresco;
grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;
grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;

  • Extract the alfresco.war from an Alfresco 2.1+ TomCat or WAR download package.
  • Unpack WAR to temp location (unzip alfresco.war)
  • Remove the file WEB-INF/lib/portlet-api-lib.jar
  • Modify WEB-INF/web.xml and add /WEB-INF/faces-config.xml to the faces config files list similar to the example below:
<context-param>
   <param-name>javax.faces.CONFIG_FILES</param-name> 
   <param-value>/WEB-INF/faces-config.xml,/WEB-INF/faces-config-app.xml,/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-common.xml,/WEB-INF/faces-config-repo.xml,/WEB-INF/faces-config-wcm.xml,WEB-INF/faces-config-custom.xml</param-value>
</context-param>

  • Add the files faces-config.xml, liferay-display.xml, liferay-portlet.xml, portlet.xml to the WEB-INF dir. These files for Liferay 4.3 without liferay-plugin-package.xml can be downloaded from here http://wiki.alfresco.com/w/images/4/4.../Liferay43files.zip. Files for Liferay 5.0 including the below mentioned liferay-plugin-package.xml can be downloaded from here http://wiki.alfresco.com/w/images/e/e.../Alf29_liferay5.zip.
    • From Liferay 4.3.1.1 and onwards you also need a file called liferay-plugin-package.xml. Save this file under WEB-INF in your exploded war. Replace the DTD with the DTD appropriate one for your Liferay version (e.g. 5.0.0 and 5_0_0). Also change the Liferay version in the end of the file to the version of your installation.  Then this file's content should look similar to this:

<plugin-package>
  <name>Alfresco Portlet</name>
  <module-id>alfresco/alfresco/2.1/war</module-id>
  <types>
    <type>portlet</type>
  </types>
  <tags>
    <tag>content</tag>
  </tags>
  <short-description>This is the Alfresco portlet.</short-description>
  <change-log>Adapted to the latest version of Liferay.</change-log>
  <page-url>http://www.alfresco.com</page-url>
  <author>Alfresco Software, Inc.</author>
  <licenses>
    <license osi-approved='true'>GPL</license>
  </licenses>
  <liferay-versions>
    <liferay-version>4.3.*</liferay-version>
  </liferay-versions>
</plugin-package>

Note: that you should apply the appropriate Liferay version number to the <liferay-version> section e.g. 4.3.6 or 5.2.1.


    • From Liferay 4.3.1.1 and onwards you also have to replace the DTD definition in the header of liferay-portlet.xml to prevent a SAX exception. Replace the DTD with the DTD appropriate for your Liferay version (e.g. 5.0.0 and 5_0_0). The header should look similar to this:


  • Sometimes changing of DTD versions (e.g. 5.0.0 and 5_0_0) will not work so revert back to original one.
  • Repack the WAR file.Make sure it is a war file not exploded war file.
  • Deploy the WAR to C:\Documents and Settings\<username>\liferay\deploy (or wherever your Liferay deploy dir is located)
  • Add the mysql-connector-java-5.*.*-bin.jar file (from Alfresco download package or from the MySQL download site) to \liferay-portal-tomcat-*.*-*.*.*0\common\lib (or to liferay/lib/ext if you have liferay+tomcat package version).
  • Start Liferay.
  • Once Liferay has started, you will see a new Alfresco category when added portlet content to your page. There are several interesting portlets called:
    • AlfrescoMyTasks - Task list for current user.
    • AlfrescoDocList - Document List portlet.
    • AlfrescoMySpaces - My Spaces document/folder list portlet. New files can be uploaded and folders created via this portlet.
    • AlfrescoMyWebForms - WCM forms available in any WebProject the user is assigned to.
    • AlfrescoMyWebFiles - WCM modified files in any WebProject the user is assigned to.

WARNING: Alfresco saves its content repository data under ./alf_data (eg <TOMCAT-DIR>/bin/alf_data) per default. If you delete this directory you also HAVE to delete the content in your database as the content of ./alf_data and the content in the database are strongly connected. If you delete ./alf_data and not the content of your database the alfresco portlet will probably not work.

IMPORTANT NOTES ON USERS: Portal users in Liferay need to match up with Alfresco users using the first part of the Liferay user email as the Alfresco username. You can create users as admin in Alfresco via the main web-client UI (the AlfrescoClient portlet) and the username should match a user in Liferay as the first part of the email address i.e. a user called bobsmith@liferay.org should have a user in Alfresco called bobsmith then the portlets will automatically perform a single-sign on to Liferay+Alfresco without displaying the Alfresco login screen.

NOTE: these instructions will only work on Liferay 4.3+ and will not work with Liferay 4.2 or earlier or with Liferay+jboss bundles.


Troubleshooting


Alfresco doesn't start (missing libs)


The catalina log shows:

18-Sep-2007 09:18:13 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
18-Sep-2007 09:18:13 org.apache.catalina.core.StandardContext start
SEVERE: Context /alfresco startup failed due to previous errors

and the localhost log shows:

Sep 18, 2007 9:18:13 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of
class com.liferay.portal.kernel.servlet.PortletContextListener
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at com.liferay.util.bridges.wai.WAIPortlet.<clinit>(WAIPortlet.java:195)

Alfresco doesn't start (misconfiguration)


You may have the following errors :

  1. dir.root is relative, and it seems to be a problem in portal context
  2. index isn't synchronized
  3. content store is not present
  4. JSF classes error(util bridges error)



To solve these problems, just :

  1. fix dir.root in alfresco/WEB-INF/classes/alfresco/repository.properties with an absolute path
  2. fix index.recovery.mode in alfresco/WEB-INF/classes/alfresco/repository.properties with FULL
  3. drop you mysql database for alfresco with db_remove.sql then recreate it with db_setup.sql
  4. Put util-bridges.jar into alfresco/WEB-INF/lib

And just restart, it should work