Friday, April 20, 2012

How to deploy portlet in CQ5.5

Use Case: You want to deploy portet in CQ5.5

Prerequisite: http://dev.day.com/docs/en/cq/current/administering/cq_as_portal_54.html Above
document covers most of the part. I will cover what is changed in CQ5.5

There is no servlet engine UI. So you can not deploy your portlet application using Day servlet engine any more.

 Here is steps to deploy portlet war file in CQ5.5

 1) Chose any servlet engine of your choice. I am taking example of tomcat in this case
 2) Deploy your CQ war file using instruction given in http://dev.day.com/docs/en/cq/current/howto/install_application_server.html
 3) Install package given in /opt/portal/cq-portlet-components.zip using CQ package manager
 4) Using webDav copy /libs/portal/director/cq-portlet-director-sharedlibs.*.jar in put it in your shared lib directory of your servlet container (I put it in /libs folder of tomcat) 
5) Now take cq-portlet-webapp-*.war (This is just an example war for OOTB portlet) and deploy it in your servlet container (In my case I just put it in webapps folder of tomcat)
6) After deploying make sure that it is accesible using http://HOST:PORT/cqportlet/cqbridge/system/console
7) Now follow instruction in http://dev.day.com/docs/en/cq/current/administering/cq_as_portal_54.html#Configuring the Portlet and give your CQ end point.
8) Now go to web.xml of your portlet war file and add following entry

    <servlet-name>slingportal</servlet-name>
     <servlet-class>org.apache.sling.portal.container.api.ContainerServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>slingportal</servlet-name>
        <url-pattern>/SlingPortletInvoker</url-pattern>
    </servlet-mapping>

9) Then add portlet component and test as given in http://dev.day.com/docs/en/cq/current/administering/cq_as_portal_54.html#Using CQ as a Portal

Portlet support is very limited in CQ5.5, So unless it is absolutely required, do not use it.

Note: As always, Please test before using this to production 

2 comments: