cancel
Showing results for 
Search instead for 
Did you mean: 

Running alfresco web-script as liferay portlet

ralph
Champ in-the-making
Champ in-the-making
Hi,

I'm working on a project using both liferay and alfresco to create a portlet in liferay.
I integrated alfresco as a liferay portlet.
I've tried to follow the hello world example from this tutorial http://ecmarchitect.com/images/articles/alfresco-webscripts/web-script-article.pdf using web script (I have updated portlet.xml, liferay-portlet.xml and liferay-display.xml as told int the Jeff Potts tutorial http://www.optaros.com/blogs/running-alfresco-web-scripts-liferay-portlets) but it does not work due to this error in liferay : alfresco/portlet_id/invoke/ ressource is not available.

Could someone help me please  Smiley Sad
4 REPLIES 4

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

Try adding this to your web.xml in alfresco.



   <servlet>
      <servlet-name>AServlet</servlet-name>
      <servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class>
      <init-param>
         <param-name>portlet-class</param-name>
         <param-value>org.alfresco.web.scripts.portlet.WebScriptPortlet</param-value>
      </init-param>
      <load-on-startup>0</load-on-startup>
   </servlet>

        <servlet-mapping>
      <servlet-name>AServlet</servlet-name>
      <url-pattern>/portlet_id/*</url-pattern>
   </servlet-mapping>



Hope this helps.

Best Regards,
Shagul

ralph
Champ in-the-making
Champ in-the-making
Hi Shagul,

It works perfectly  Smiley Very Happy

Thank you so much for your precious help Smiley Happy

kkhimani
Champ in-the-making
Champ in-the-making
Hi Ralph,

I am trying to access webscript as Portlet from Jboss using Alfresco 2.1 community edition. As you have done these successfully, would like to know if you have received following error.

I have created separate WAR and deployed the same in the same Jboss Portal instance where alfresco.war is deployed. On the startup of the portlet it is throwing following error:

Caused by: java.lang.NullPointerException
        at org.alfresco.web.scripts.portlet.WebScriptPortlet.init(WebScriptPortlet.java:93)
        at org.jboss.portal.portlet.container.PortletContainer.initPortlet(PortletContainer.java:387)
        at org.jboss.portal.portlet.container.PortletContainer.start(PortletContainer.java:249)

Here is line source code in WebScriptPortlet.init(WebScriptPortlet.java:93)
registry = (DeclarativeWebScriptRegistry)ctx.getBean("webscripts.registry");

Same error posted here as well - http://forums.alfresco.com/en/viewtopic.php?f=6&t=13328

Alfresco portlet and Webscript Portlets that comes with alfresco are working fine in JBoss Portal.

I have added required jars in web application - alfresco-core.jar, alfresco-web-client.jar and spring-2.0.2.jar. But not added any Spring configuration files, do I need to add any of them in my web application?

Have you built your web application as a separate WAR? Or you are adding your application source within alfresco.war.

Thanks,
Ketan.

deepak1987
Star Contributor
Star Contributor
Hi,

I have tried the following steps but still I'm getting error : The requested resource (/share/service/sample/helloworld) is not available

I'm using Alfresco 3.3.2 & Liferay 5.2-ee-sp3 version.

Step 1. Configuring Liferay’s Tomcat Server to resolve port conflicts by editing <LIFERAY_HOME>/<tomcat>/conf/server.xml:
Change all the port numbers to avoid conflicts with the Alfresco’s Tomcat server, here are the changes I made:



<Server port="8105" shutdown="SHUTDOWN">

<Connector port="9090" protocol="HTTP/1.1"
       connectionTimeout="20000"
       redirectPort="9443" URIEncoding="UTF-8" />

<Connector port="8109" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8" />



Step 2. Next, edit<LIFERAY_HOME>/<tomcat>/conf/catalina.properties and locate the “shared.loader” entry and replace it with this:

shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar

Step 3. Edit <ALFRESCO_HOME>/tomcat/shared/classes/alfresco-global.properties and add the following lines to the end of the file:

authentication.chain=alfrescoNtlm1:alfrescoNtlm,external1:external
external.authentication.proxyUserName=


NOTE: Yes, the value for proxyUserName needs to be blank.

Step 4. Copy <ALFRESCO_HOME>/tomcat/webapps/share.war to <LIFERAY_HOME>/deploy

Step 5. Copy the entire <ALFRESCO_HOME>/tomcat/shared directory to<LIFERAY_HOME>/<tomcat>/

NOTE: Technically, we only need the shared/classes/alfresco/web-extension directory, but copying the whole shared directory is a convenient alternative.

Step 6. Rename <LIFERAY_HOME>/<tomcat>/shared/classes/alfresco/web-extension/webscript-framework-config-custom.xml.sample to webscript-framework-config-custom.xml and edit the file to uncomment the second config block to enable remote authenticator. The comments are on lines 44 and 73. The result should look like this:



<!–    sessions" feature of your load balancer must be used –>

<config evaluator="string-compare" condition="Remote">
   <remote>
     <!– SSL client certificate + trusted CAs. Optionally used to authenticate share to an external SSO system such as CAS –>

     <keystore>
     …
     </keystore>

     <connector>
     …
     </connector>

     <endpoint>
       <id>alfresco</id>
       <name>Alfresco - user access</name>
       <description>Access to Alfresco Repository WebScripts that require user authentication</description>
       <connector-id>alfrescoCookie</connector-id>
       <endpoint-url>http://localhost:8080/alfresco/wcs</endpoint-url>
       <identity>user</identity>
       <external-auth>true</external-auth>
     </endpoint>    

   </remote>
</config>


NOTE: If you’re running Alfresco’s Tomcat server on a different host or port, please change the corresponding endpoint.

Step 7. Startup Alfresco, then follow up with starting Liferay.

Step 8. Once Alfresco and Liferay are started, add and try out the basic CMIS Repo Browser portlet. It should appear under the “Alfresco” category.


AND I have edited the following web.xml file

In  \<LIFERAY-HOME>\tomcat\webapps\share\WEB-INF\web.xml


<servlet>
      <servlet-name>HelloWorld</servlet-name>
      <servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class>
      <init-param>
         <param-name>portlet-class</param-name>
         <param-value>org.alfresco.web.scripts.portlet.WebScriptPortlet</param-value>
      </init-param>
      <load-on-startup>0</load-on-startup>
   </servlet>

        <servlet-mapping>
      <servlet-name>HelloWorld</servlet-name>
      <url-pattern>/helloworld/*</url-pattern>
   </servlet-mapping>


Plz, help me on this….

Thanks a lot,
Deepak