Alfresco 3.3 delivers CMIS support, integration with Liferay 6

Alfresco 3.3 with implementation of CMIS provides interoperability of its enterprise content management system with Liferay 6. In previous blogs Integrating Alfresco through CMIS in Liferay and the book: Liferay Portal 6 Enterprise Intranets, we have discussed how to integrate Alfresco 3.2 through CMIS 1.0 in Liferay 6. In this article, we are going to introduce how to integrate Alfresco 3.3 through CMIS 1.0 in Liferay 6. 

This article will use Alfresco 3.3 E and Liferay portal 6.0.2 to show how to integrate Alfresco through CMIS in Liferay.  Of course, you can do the same for Alfresco 3.3 or above community (or enterprise) version.

Integration

You should be able to integrate Alfresco through CMIS in following steps

  • Install Liferay portal 6.0.2 (revision 54489) or above at $LIFERAY_HOME; Liferay-Tomcat bundle is expressed as $TOMCAT_AS_DIR; and $PORTAL_ROOT_HOME = $TOMCAT_AS_DIR/webapps/ROOT;
  • Locate Alfresco 3.3 WAR ${alfresco.war} and Share WAR ${shared.war} at $ALFRESCO_INSTALLATION/ tomcat/webapps
  • Drop ${alfresco.war} and ${shared.war} to $TOMCAT_AS_DIR/webapps;
  • Create a database alfresco in MySQL.
    drop database if exists alfresco;
    create database alfresco character set utf8;
    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;

  • Optionally, create database lportal in MySQL
    drop database if exists lportal;
    create database lportal character set utf8;
    grant all on lportal.* to 'lportal'@'localhost' identified by 'lportal' with grant option;
    grant all on lportal.* to 'lportal'@'localhost.localdomain' identified by 'lportal' with grant option;

  • Create a file named portal-ext.properties at $PORTAL_ROOT_HOME/WEB-INF/classes and add following lines in portal-ext.properties.
    dl.hook.impl=com.liferay.documentlibrary.util.CMISHook
    cmis.credentials.username=admin
    cmis.credentials.password=admin
    cmis.repository.url=http://localhost:8080/alfresco/service/api/cmis
    cmis.repository.version=1.0
    cmis.system.root.dir=Liferay Home

  • Optionally, add database connection in portal-ext.properties.
    ## MySQL
    jdbc.default.driverClassName=com.mysql.jdbc.Driver
    jdbc.default.url=jdbc:mysql://localhost:3306/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
    jdbc.default.username=lportal
    jdbc.default.password=lportal

Of course, you can use different database systems.

  • Start the portal

By the way, you can download Alfresco 3.3 E WAR and Share WAR directly from

/palm_tree/book/0387/chapter12/cmis/1.0/

Of course, you can get the latest WAR of Alfresco Community version or Enterprise (Trial) version from Alfresco website

http://www.alfresco.com/try/

Results

In Control panel of Liferay portal, select default community “liferay.com”; 

going to Content->Document Library, create a folder "Liferay Home" and upload a document under this folder as shown in following screenshot.

Logging in Alfresco as "admin/admin", you would see the folder "Liferay Home" and the document as shown in following screenshot. That is, Alfresco becomes direct repository of Liferay Document Library via CMIS. All real content is stored in Alfresco, while all metadata is stored in Liferay database.

In brief, Liferay supports CMIS 1.0 100%. Isn’t it? You can integrate other ECM or related systems easily via CMIS in Liferay portal, like Dennis Hamilton, EMC, FatWire, IBM, Microsoft, Open Text, Oracle and SAP, etc.

Blogs
Hi! thanks Jonas, does versioning of the same file work when uploading from the liferay's side?
Hi Charles,thanks. Logically, versioning of the same file should work when uploading from the Liferay side. Do you have a chance to test it? It would be nice that you could share your testing results here.
Thank you for the nice article:

Just a quick question Jonas, is it not necessary to declare cmis endpoint (repo.remote.endpoint.url) in alfresco main file config (alfresco-global.properties) for getting cmis repository available ? I think it should be, although I'm working with alfresco deployed in other machine. Maybe that's the point.

Regards.
Hi Cesar, thanks. Yes, you are right. The cmis endpoint is required when Alfresco is installed in different server (different domain and port number) or Alfresco is installed in same server but using different port number like 80.

Generic configuration would be
cmis.repository.url=http://${domain}:${port}/alfresco/service/api/cmis.
Hi
my alfresco port is 8080 and my liferay port is 8081
should I use the Generic configuration and where?
if Yes, whith what should I replace {domaine} and {port} is it 8080?

I ask that because i have this error
ERROR [web.context.ContextLoader] Context initialization failed
org.alfresco.error.AlfrescoRuntimeException: 02010001 Ensure that the 'dir.root' property is pointing to the correct data location.
at org.alfresco.repo.admin.ConfigurationChecker.check(ConfigurationChecker.java:332)
at org.alfresco.repo.admin.ConfigurationChecker.access$000(ConfigurationChecker.java:68)
at org.alfresco.repo.admin.ConfigurationChecker$1.execute(ConfigurationChecker.java:180)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:321)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:247)
at org.alfresco.repo.admin.ConfigurationChecker.onBootstrap(ConfigurationChecker.java:184)
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:294)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:858)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:419)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
1 mars 2011 07:52:33 org.apache.catalina.core.StandardContext start
GRAVE: Error listenerStart
1 mars 2011 07:52:33 org.apache.catalina.core.StandardContext start
GRAVE: Erreur de d�marrage du contexte [/alfresco] suite aux erreurs pr�c�dentes
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
Hi
I removed alfresco and I re installed the same version.
then i started up alfresco before starting liferay and the problem was disappeared.and I can create and delete documents in alfresco throw liferay portal.
Is that logic
Hi!
I also try this with Alfresco in other machine and without setting the porperty "repo.remote.endpoint.url" that Cesar told it wasn't work.
And I have some doubts about it...is it posible to create the same folder/documents hierarchy in Alfresco?
Instead of:
Liferay Home -> 10130 -> 10274 -> 1 -> 1.0

Something like:
Liferay Home -> Sysmposium Registration Form.docx

Maybe overriding some code from Liferay or Alfresco??

Because I think searching in Alfresco with that folders and documents names will be a torture!

Thanks in advance!
Hi Ana, thanks. You do have good point. Liferay CMIS here provides generic path for content (Document Library documents).

Liferay Home -> 10130 -> 10274 -> 1 -> 1.0

It covers portal instance (if you had multiple virtual instances), group info (you may have many organizations or communities for a given portal instance), and Document Library document ID (providing a link of document meta-data in Document Library and content in Alfresco).

In normal use cases, I think above info should be required. Isn't it?
hi!can you please help me...i have been trying to work out on this for so long but not able to find an error correctly...
i made an organization hierarchy and also made each organization's page wiki...i wanted to create a hierarchy in such a way that only top level organization-e.g,like the name of the organization acts like the administrator,its children organization-e.g,Engineering,HR,Sales and Finance are separate organizations and Engineering's further children organizations-LSI Division,MSI Division,Embedded and Enterprise...i wanted to create wikis in such a way that top level organization can do anything with the child orgs...Engineering org can edit and view its own wikis but not HR'S or other organizations and its sub-organziations-LSI,MSD,Sales and Finance can also edit and view its own wikis but cannot edit Engineering's wiki or top organization's wiki...
i also created different roles e.g-Org wiki admin,Org wiki edit and Org wiki view for three users i created resp for admin,edit and view purpose and so provided the resp permissions also.
Now my problem is when i log in using any of these 3 users,i can just edit the wiki page through which a particular organization's page i viewed that wiki and can just view other wikis whether its a parent-child org also...its with all the three users when infact they should have different access control according to the roles created....
please help me...
Hi Anshul, thanks. It seems that you have questions on how to use Liferay organizations. You may refer details from the book: Liferay Portal 6 Enterprise Intranets.
Thanks Jonas for this interesting article.
CMIS integration worked, but when I try to delete a file it shows the following error:
*********************
13:31:29,214 User:admin ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 08060008 Could not de
lete folder with at least one Child
org.springframework.extensions.webscripts.WebScriptException: 08060008 Could not delete folder with at least one Child
at org.alfresco.repo.cmis.rest.CMISScript.deleteObject(CMISScript.java:1102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
at org.mozilla.javascript.gen.c4._c0(file:/D:/liferay-portal-tomcat-6.0.5/liferay-portal-6.0.5/tomcat-6.0.26/webapps/alfresco/WEB-INF/classes/alfresco/t
emplates/webscripts/org/alfresco/cmis/item.delete.js:74)
Hi Sultee, thanks. Do you get this issue solved?

You may take following steps:
1) shut down the portal;
2) clean up data (alfresco database, alfresco repository, liferay database and liferay repository);
3) start up the portal.

You would be able to fix the issue you mentioned by above steps.

Hope that it helps,
Jonas,

imagine the situation, ok I want to use alfresco as a document repository, but when I do a search in search portlet of liferay I want the result to include the documents also from Alfresco. How is this possible ? CMIS will do this ? or it will enable liferay to use alfresco to store the documents...

ilke
Hi Ilke, you can use Open Search. Eventually, there is an example called alfresco-content portlet. For more details, you may refer to the books: Liferay Portal 6 Enterprise Intranets or Liferay Portal 5.2 Systems Development.

Please let me know if you meet any issues,

Thanks

Jonas
ilke:

Alternatively to opensearch, there exists a community portlet called alfresco search based on alfresco web services.

http://www.liferay.com/downloads/liferay-portal/community-plugins/-/software_catalog/products/4633564
Thank you, Cesar.

Example Alfresco 3.4 and Liferay 6 CMIS integration would be ready shortly.
Hi,

i have a little problem to integrate Alfresco, so maybe you´ve got the same problem an we can share our solutions.

If you like, follow this Link to the Forum, thanks.
http://www.liferay.com/de/community/forums/-/message_boards/message/6457689?_19_preview=false#_19_message_6457689
Hi Tobias, it seems that you miss alfresco database.

Create a database alfresco in MySQL.

drop database if exists alfresco;
create database alfresco character set utf8;
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;
Yap,
thanks i solved that problem a log time ago, i think it was an MySQL Fail as you expected. I just reseted MySQL DB and also the User.

Now, I´ll finish my "projekt" and at that point I´ll set an "how to" for an: [Tomcat01(Lifray<->Alfresco)<->Tomcat02(CAS)<->LDAP] Server Komplex in the Liferay Forum.
----
Now i try to write with Alfresco in Liferay DB via "http://wiki.alfresco.com/wiki/Doclib_Portlet". I hope it will work.
The CAS integration with an LDAP as USER DB, work´s fine for both systems.

And thanks, with out this fine community, I´ll never get that far.