Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-138499

UnsupportedOperationException thrown by CDIBeanPortletExtension when a Portlet 2.0 JSF portlet is registered as a bean portlet

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 7.1.0 CE GA1, 7.1.1 CE GA2, 7.1.2 CE GA3, 7.1.3 CE GA4, 7.2.0 GA1, 7.2.1 CE GA2, 7.3.0 CE GA1, 7.3.1 CE GA2, 7.3.2 CE GA3, 7.3.3 CE GA4, 7.3.4 CE GA5, 7.3.5 CE GA6, 7.3.6 CE GA7, 7.3.7 CE GA8, 7.4.0 CE GA1, 7.4.1 CE GA2, 7.4.2 CE GA3
    • Fix Version/s: 7.4.13 DXP GA1, Master
    • Labels:
      None

      Description

      Problem Background

      JSF portlet developers now have the ability for JSF portlets to take advantage of OSGi+CDI integration via the OOTB weld-osgi-bundle.jar module.

      However, until JSR 378 is released, JSF portlet developers must use Liferay Faces Bridge 4.x (Portlet 2.0 + JSF 2.2). This means that the portlet.xml descriptor would be set to version="2.0". The problem is that CDIBeanPortletExtension._invokeBeanPortletMethod(...) assumes Portlet 3.0 and when it calls ActionRequest.getActionParameters(). Because of this, when a Portlet 2.0 portlet tries to register as a bean portlet, an UnsupportedOperationException is thrown by ActionRequestImpl.getActionParameters().

      In order to accommodate registration of Portlet 2.0 portlets as bean portlets, CDIBeanPortletExtension should alternatively call ActionRequest.getParameter(String) instead.

      Workaround

      In order to workaround this issue, demo portlets like the jsf-cdi-applicant-portlet specify version="3.0" in portlet.xml. However, this is not a good workaround since Liferay Faces Bridge 4.x is designed to be used in a Portlet 2.0 container at runtime.

      Steps to Reproduce

      1. Deploy the attached com.liferay.test.lps138499.portlet.war artifact to $LIFERAY_HOME/deploy

      2. Monitor the console log and make sure it reports the following regarding registration of a bean portlet:

      [BeanPortletRegistrarImpl:288] Registered 1 bean portlets and 0 bean filters for com.liferay.test.lps138499.portlet
      

      3. Create a Widget Page named "LPS-138499"

      4. Add the "com.liferay.test.lps138499.portlet" to the widget page

      5. Click on the "Submit" button

      Expected Result

      The portlet redisplays without any changes, and the following appears in the console log:

      Inside myAction
      

      Actual Result

      The following stacktrace will appear in the console log:

      Caused by: java.lang.UnsupportedOperationException: Requires 3.0 opt-in
      	at com.liferay.portlet.internal.ActionRequestImpl.getActionParameters(ActionRequestImpl.java:41) ~[portal-impl.jar:?]
      	at com.liferay.bean.portlet.cdi.extension.internal.CDIBeanPortletExtension._invokeBeanPortletMethod(CDIBeanPortletExtension.java:494) ~[?:?]
      	... 183 more
      

        Attachments

          Activity

            People

            Assignee:
            hugo.huijser Hugo Huijser
            Reporter:
            neil.griffin Neil Griffin
            Participants of an Issue:
            Recent user:
            Sophia Zhang
            Engineering Assignee:
            Neil Griffin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              13 weeks, 3 days ago

                Packages

                Version Package
                7.4.13 DXP GA1
                Master