Integrating a Portlet into AEM on JBoss Application Server

Integrating a Portlet into AEM on JBoss Application Server

Deploying a portlet into AEM is very simple, but you need to add a jar into a shared location of JBoss Application Server which is the tricky part.

CQ Portlet Component

– After unwrapping AEM jar file, you will see “cq-portlet-components.zip” file at “/crx-quickstart/opt/portal” location. The zip file contains a portlet component with required jar files. Copy the zip file to some location of your machine.

– Unzip “cq-portlet-components.zip” and copy “cq-portlet-director-sharedlibs-5.4.2.jar” from \libs\portal\director to your local file system.

Installing AEM on JBoss AS

– Deploy AEM war file in JBoss Application Server. Please follow this post https://rmengji.wordpress.com/2014/06/05/installing-aem-on-jboss-application-server/

for installing AEM on JBoss AS.

Installing Portlet component on AEM application

– Go to AEM (installed on the JBoss server) package manager and install “cq-portlet-components.zip”.

Configuring Shared library on Jboss

– You have to copy “cq-portlet-director-sharedlibs-5.4.2.jar” into a shared location on JBoss server so that other applications can access it.

– You can create a shared library on JBoss using a module.

– Go to “<JBoss Installation Directory>\modules” and create a folder structure as per your requirement. E.g., “<JBoss Installation Directory>\modules\com\rmengji\shredlibrary\main”. Please note that main directory is mandatory at the end of your folder structure.

– Copy “cq-portlet-director-sharedlibs-5.4.2.jar” into the main folder of the structure you have just created. E.g., “<JBoss Installation Directory>\modules\com\rmengji\shredlibrary\main”.

– Create a file with name “module.xml” in the main folder and include the following xml code:

module

 

 

 

 

– Go to “standalone.xml” file in “<JBoss Installation Directory>\standalone\configuration\” and edit the following “subsystem” tag with the following code:

subsystem

 

 

 

 

– Restart the JBoss Application Server.

Deploy a Portlet Component war on to the JBoss server

– add the following xml code snippet into the web.xml of the the portlet component.

 <servlet>
<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>

 

If you’ve received a portlet as a war file, then import the war into eclipse, edit the web.xml and export it as war file.

Using the Portlet component on AEM page

– Open your AEM page, go to design mode and add “Portlet” component place under “General” component group.

– Drag and Drop the portlet component on to the parsys.

– Open the portlet component and select the portlet you have just deployed on the JBoss application server.

dialog

 

 

 

 

 

 

 

– Click “OK” and then you should see the ouput of the portlet component onto your AEM page.

2 responses to “Integrating a Portlet into AEM on JBoss Application Server”

  1. Rama Avatar
    Rama

    Hi Rahul.

    Nice summary.

    1. In order to use AEM as a Portal server, does it need to be installed as a Web Application WAR on any Application Server like JBoss or Tomcat, and not as Quickstart JAR?

    2. My Quickstart installation also has cq-portlet-components.zip at crx-quickstart\opt\portal.

    2. I want to do a small POC on this. Which Appserver is the best for this? JBoss or Tomcat?

    Thanks,
    Rama.

Leave a comment