Pluto
  1. Pluto
  2. PLUTO-488

When executing doAction/doRender/doLoad/doAdmin and retrieving the servlet context of the portlet app fails, a generic NullPointerException is thrown

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.1.5, 2.0.0
    • Fix Version/s: 1.1.6, 2.0.0
    • Component/s: portlet container
    • Labels:
      None
    • Environment:
      Tomcat 5.5.26

      Description

      A very common error when working with JSR-168 portlets for the first time is when the servlet context of the portlet app cannot be accessed by the portal app. This is usually due to an app server misconfiguration (ex: forgetting to set crossContext="true" on Tomcat) or a failed deployment of the portlet app.

      On Pluto 1.1.5, when trying to render a portlet and the servlet context of the portlet app cannot be retrieved, a generic NullPointerException is thrown from DefaultPortletInvokerService.invoke (line 151). It would be much better to throw a PortletContainerException with a detailed message of the problem.

      This is actually already implemented in PortletContainerImpl.getPortletApplicationDescriptor (line 387), but the same logic is not used in the doRender, doAction, doLoad, and doAdmin methods of PortletContainerImpl. This code could be pulled out into a private method on PortletContainerImpl, or it could be placed directly into PortletContextManager.getPortletContext(ServletContext, String).

      1. P488-1.1.x-Rev656347.diff
        5 kB
        Nikita Dubrovsky
      2. P488-trunk-Rev670645.diff
        4 kB
        Nikita Dubrovsky

        Activity

        Nikita Dubrovsky created issue -
        Hide
        Nikita Dubrovsky added a comment -

        Attached a patch with the proposed fix (modified PortletContainerImpl).

        Show
        Nikita Dubrovsky added a comment - Attached a patch with the proposed fix (modified PortletContainerImpl).
        Nikita Dubrovsky made changes -
        Field Original Value New Value
        Attachment P488-1.1.x-Rev656347.diff [ 12382132 ]
        Nikita Dubrovsky made changes -
        Fix Version/s 1.1.6 [ 12313075 ]
        Hide
        Craig Doremus added a comment -

        Thanks for the patch Nikita. I will commit it in a day or two. I think that this issues is also present in the Pluto 2.0 codebase, but the PortletContainerImpl class is very different from the file in the 1.1.x branch. Is it possible that you could produce a patch for the trunk too? TIA

        Show
        Craig Doremus added a comment - Thanks for the patch Nikita. I will commit it in a day or two. I think that this issues is also present in the Pluto 2.0 codebase, but the PortletContainerImpl class is very different from the file in the 1.1.x branch. Is it possible that you could produce a patch for the trunk too? TIA
        Craig Doremus made changes -
        Fix Version/s 2.0.0 [ 12312914 ]
        Hide
        Craig Doremus added a comment -

        Patch applied in SVN rev 661639 to 1.1.x branch..

        Show
        Craig Doremus added a comment - Patch applied in SVN rev 661639 to 1.1.x branch..
        Craig Doremus made changes -
        Affects Version/s 2.0.0 [ 12312914 ]
        Affects Version/s 1.1.5 [ 12312652 ]
        Fix Version/s 1.1.6 [ 12313075 ]
        Hide
        Nikita Dubrovsky added a comment -

        I have never worked with Pluto 2.0 yet, but I will take a look next week (I am on vacation for the next 4 days and should be able to create a patch for it. Thanks for applying the patch!

        Show
        Nikita Dubrovsky added a comment - I have never worked with Pluto 2.0 yet, but I will take a look next week (I am on vacation for the next 4 days and should be able to create a patch for it. Thanks for applying the patch!
        Nikita Dubrovsky made changes -
        Fix Version/s 1.1.6 [ 12313075 ]
        Affects Version/s 1.1.5 [ 12312652 ]
        Hide
        Nikita Dubrovsky added a comment -

        Attached a patch for Pluto 2.0. Instead of modifying the individual methods in PortletContainerImpl, I modified the static utility method PortletContextManager.getPortletContext().

        Show
        Nikita Dubrovsky added a comment - Attached a patch for Pluto 2.0. Instead of modifying the individual methods in PortletContainerImpl, I modified the static utility method PortletContextManager.getPortletContext().
        Nikita Dubrovsky made changes -
        Attachment P488-trunk-Rev670645.diff [ 12384509 ]
        Hide
        Craig Doremus added a comment -

        Added P488-trunk-Rev670645.diff patch to trunk in SVN rev 678278. Thanks Nikita!

        Show
        Craig Doremus added a comment - Added P488-trunk-Rev670645.diff patch to trunk in SVN rev 678278. Thanks Nikita!
        Hide
        Craig Doremus added a comment - - edited

        Applied P488-trunk-Rev670645.diff patch in rev 678334 and 678336 to pluto-2.0-refactoring branch.

        Show
        Craig Doremus added a comment - - edited Applied P488-trunk-Rev670645.diff patch in rev 678334 and 678336 to pluto-2.0-refactoring branch.
        Hide
        Craig Doremus added a comment -

        Patch applied to trunk and 1.1.x and pluto-2.0-refactoring branches.

        Show
        Craig Doremus added a comment - Patch applied to trunk and 1.1.x and pluto-2.0-refactoring branches.
        Craig Doremus made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Mark Thomas made changes -
        Workflow jira [ 12431163 ] Default workflow, editable Closed status [ 12564747 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12564747 ] jira [ 12585979 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Nikita Dubrovsky
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development