Deploying JSF Portlets on IBM WebSphere
This tutorial shows how to deploy JSF portlets on IBM WebSphere Application Server (WAS) 8.0. Note that this tutorial assumes that you are using Liferay Portal 6.1. For more information, see Installing Liferay on WebSphere 8.0.
Portlet Deployment on WAS 8.0 #
With servlet containers like Tomcat/Resin/Jetty and application servers like JBoss/GlassFish, deploying a portlet is as simple as copying the WAR artifact to the $LIFERAY_HOME/deploy folder. However, Liferay's integration with WAS requires a slightly different setup. If you don't have one already, create a portal-ext.properties file in the $LIFERAY_HOME folder, and add the following property:
Then, when you deploy a portlet WAR artifact to the LIFERAY_HOME/deploy folder, Liferay Portal will extract the WAR and modify descriptors like WEB-INF/web.xml before it re-zips the WAR and copies it to the websphere-deploy folder. Liferay Portal will then detect the modified WAR and auto-register the portlets with WAS. Unlike earlier versions of WAS, it is not necessary to use the WAS Admin Console to manually deploy the modified WAR. However, JSF portlets require some additional steps before the WAR context will startup properly.
Upgrade Mojarra #
Liferay Faces 3.x requires JSF 2.1. For detailed upgrade instructions, please refer to Upgrading Mojarra in IBM WebSphere.
The Mojarra jsf-api.jar and jsf-impl.jar dependencies must not appear in the WEB-INF/lib folder of JSF portlets. Instead, each JSF portlet must reference the Mojarra 2.1 Shared Library in its classpath. In addition, each JSF portlet must specify PARENT_LAST as a classloader policy so that the Mojarra 2.1 classes in the Shared Library are loaded before the Mojarra 1.2 classes that are in the global classpath by default.
Deployment Instructions #
Step 1: In the WAS Admin Console, click on Applications->Application Types->WebSphere Enterprise Applications
Step 2: When the Enterprise Applications page appears, click on the hyperlink for your JSF portlet:
Step 3: Click on Class Loading and Update Detection
Step 4: Click on Classes Loaded with Local Class Loader First (Parent Last) and also Class Loader for Each WAR File in Application, then click OK.
NOTE: For more information on PARENT_LAST, see the WebSphere documentation.
Step 5: If prompted, click on the Save Directly link in order to save the master configuration.
Step 6: When the Enterprise Applications page appears, click on the hyperlink for your JSF portlet.
Step 7: Click on JSP and JSF Options
Step 8: Select SunRI 1.2 (select 1.2, even though we're deploying JSF 2.1) and click OK.
Step 9: If prompted, click on the Save Directly link in order to save the master configuration.
Step 10: Click on Shared Library References
Step 11: When the Shared Library References page appears, click on the first checkbox for your portlet, then click on Reference Shared Libraries.
Step 12: When the Shared Library Mapping page appears, click on Mojarra 2.1 in the list on the left and then click on the right-arrow button in order to send it to the list on the right.
Step 13: Verify that Mojarra 2.1 is specified as a Shared Library.
Step 14: When the Enterprise Applications page appears, click on the hyperlink for your JSF portlet, and then click Start. You should now be able to add the portlet to a portal page.