Jetspeed 2
  1. Jetspeed 2
  2. JS2-315

Premature access to portal can break access to portlets.

    Details

      Description

      When the portal is first deployed, and a user attempts to access the portal before the portlet apps have been deployed into Tomcat, the portlets do not display correctly. This is to be expected, as the target portlet app is yet to register itslef into the portlet registry. However, due to caching of portlet windows and hence portlet entities, this cannot be corrected and the portal must be bounced.

      To fix this, I have added logic to the PortletEntityImpl that allows it to try and load it's related PortletDefinition by looking using the Fragment that is associated with saod entity to pull the PortletDefinition from the registry, even in the case of the PortletEntity being cached.

        Activity

        Hide
        David Sean Taylor added a comment -

        I may be confusing this issue with something else....

        I think I purposely removed this code a while back because it was a serious performance bottleneck.
        See the PortletWindowAccessorImpl constructor and

        if (validateWindows)

        { validateWindow(fragment, portletWindow); }

        Im -1 on adding any code that requires a database lookup for EACH and EVERY rendering of a portlet regardless.
        Prefer that we handle exceptions, and recover from there

        Show
        David Sean Taylor added a comment - I may be confusing this issue with something else.... I think I purposely removed this code a while back because it was a serious performance bottleneck. See the PortletWindowAccessorImpl constructor and if (validateWindows) { validateWindow(fragment, portletWindow); } Im -1 on adding any code that requires a database lookup for EACH and EVERY rendering of a portlet regardless. Prefer that we handle exceptions, and recover from there
        Hide
        Scott T Weaver added a comment -

        David, the lookup only happens if the PortetDefintion of an entity is null, if it is not, not look up is performed.

        Code from PortletEntityImpl

        public PortletDefinition getPortletDefinition()
        {
        // there are cases when jetspeed gets initialized before
        // all of the portlet web apps have. In this event, premature
        // access to the portal would cause portlet entities to be cached
        // with their associated window without there corresponding PortletDefinition
        // (becuase the PortletApplication has yet to be registered).
        if(this.portletDefinition == null)

        { setPortletDefinition(registry.getPortletDefinitionByIdentifier(getPortletUniqueName())); }

        return this.portletDefinition;
        }

        Show
        Scott T Weaver added a comment - David, the lookup only happens if the PortetDefintion of an entity is null, if it is not, not look up is performed. Code from PortletEntityImpl public PortletDefinition getPortletDefinition() { // there are cases when jetspeed gets initialized before // all of the portlet web apps have. In this event, premature // access to the portal would cause portlet entities to be cached // with their associated window without there corresponding PortletDefinition // (becuase the PortletApplication has yet to be registered). if(this.portletDefinition == null) { setPortletDefinition(registry.getPortletDefinitionByIdentifier(getPortletUniqueName())); } return this.portletDefinition; }
        Hide
        David Sean Taylor added a comment -

        thats fine then
        im actually experiencing the same problem here (when I forget to deploy my app, then hit the page) so Im +1 on this one
        just wanted to make sure it wasnt the portlet window accessor situation
        thanks

        Show
        David Sean Taylor added a comment - thats fine then im actually experiencing the same problem here (when I forget to deploy my app, then hit the page) so Im +1 on this one just wanted to make sure it wasnt the portlet window accessor situation thanks
        Hide
        Ate Douma added a comment -

        The implementation for this fix always leads to:
        java.lang.IllegalArgumentException: Cannot pass a null PortletDefinition to a PortletEntity.
        at org.apache.jetspeed.components.portletentity.PortletEntityImpl.setPortletDefinition(PortletEntityImpl.java:375)
        when a portlet (definition) isn't available.

        This in turn results in a "Title Error: Cannot pass a null PortletDefinition to a PortletEntity." title for the portlet.
        This really isn't an acceptable or understandable error message for end users.

        I'm reopening this issue and will provide a less brute solution while still preventing caching of incomplete PortletWindows.

        Show
        Ate Douma added a comment - The implementation for this fix always leads to: java.lang.IllegalArgumentException: Cannot pass a null PortletDefinition to a PortletEntity. at org.apache.jetspeed.components.portletentity.PortletEntityImpl.setPortletDefinition(PortletEntityImpl.java:375) when a portlet (definition) isn't available. This in turn results in a "Title Error: Cannot pass a null PortletDefinition to a PortletEntity." title for the portlet. This really isn't an acceptable or understandable error message for end users. I'm reopening this issue and will provide a less brute solution while still preventing caching of incomplete PortletWindows.
        Hide
        Ate Douma added a comment -

        Applied an improved fix.

        Now when a Portlet (Application) isn't available when rendering a fragment, as for example by default for the ThirdParty portlets,
        you'll get an error message like:
        " Failed to retrieve Portlet Definition for GooglePortlet::GooglePortlet"

        This doesn't solve issues like JS2-234, but at least the error message now is more to the point.

        Show
        Ate Douma added a comment - Applied an improved fix. Now when a Portlet (Application) isn't available when rendering a fragment, as for example by default for the ThirdParty portlets, you'll get an error message like: " Failed to retrieve Portlet Definition for GooglePortlet::GooglePortlet" This doesn't solve issues like JS2-234 , but at least the error message now is more to the point.

          People

          • Assignee:
            Ate Douma
            Reporter:
            Scott T Weaver
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development