Deploying 2.1WAR Liferay4.3
From AlfrescoWiki
Contents |
[edit] 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 2.1 TomCat/WAR 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 thus:
<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-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 can be downloaded from here:[1]
- 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. This file's content should look similar to this:
<?xml version="1.0"?>
<!DOCTYPE plugin-package PUBLIC "-//Liferay//DTD Plugin Package 4.3.0//EN" "http://www.liferay.com/dtd/liferay-plugin-package_4_3_0.dtd">
<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>
- 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. The header should look like this:
<?xml version="1.0"?> <!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 4.3.1//EN" "http://www.liferay.com/dtd/liferay-portlet-app_4_3_1.dtd">
- Repack the 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.0.3-bin.jar file (from Alfresco download package or from the MySQL download site) to \liferay-portal-tomcat-jdk5-4.3.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 Liferay4.3 and will not work with Liferay4.2 or earlier or with Liferay+jboss bundles.
[edit] Troubleshooting
[edit] 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)
- Download the Apache Commons Logging from http://commons.apache.org/downloads/download_logging.cgi
- Unpack the archive
- Copy the three JAR files to [tomcat]/lib/ext (for the Liferay + Tomcat pre-package, probably [tomcat]/common/lib for standalone)
- Reload Tomcat.
[edit] 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
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
And just restart, it should work

