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-trunk-Rev670645.diff
        4 kB
        Nikita Dubrovsky
      2. P488-1.1.x-Rev656347.diff
        5 kB
        Nikita Dubrovsky

        Activity

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

        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
        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().
        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!
        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..
        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
        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).

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development