PUBLIC - Liferay Portal Community Edition
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-12683

Prevent any Portlet to remove the Context on which the liferay portal itself is running

    Details

    • Branch Version/s:
      6.1.x, 6.0.x
    • Backported to Branch:
      Committed
    • Fix Priority:
      5
    • Liferay Contributor's Agreement:
      Accept
    • Similar Issues:
      Show 5 results 

      Description

      In our enviroment at some point in time after starting the server, Liferay fails to render pages with our custom them.
      Initially the page are rendered properly.

      In the stdout of Tomcat I notice errors from the ServletVelocityResourceListener for finding an included vm.
      We use the default bundle, so Liferay is bound to the ROOT-content and the specified file (/html/themes/_unstyled/templates/init.vm) is present in that context.
      The ServletVelocityResourceListener calls the VelocityContextPool to the the ServletContext for the path "", which returns null, causing the ServletVelocityResourceListener to fail finding the init.vm file.

      I can't determine yet why the VelocityContextPool would fail to lookup the ServietContext for "". When I connected a debugger to the ServletVelocityResourceListener and traced into the VelocityContextPool , I found that initially it does contain an entry with "" as the key.

      Logging:

      ERROR ServletVelocityResourceListener

      • SERVLET_CONTEXT/html/themes/_unstyled/templates/init.vm is not valid because does not map to a servlet context
        ERROR velocity
      • ResourceManager : unable to find resource 'SERVLET_CONTEXT/html/themes/_unstyled/templates/init.vm' in any resource loader.
        ERROR velocity
      • #parse(): cannot find template 'SERVLET_CONTEXT/html/themes/_unstyled/templates/init.vm',
        called at nedascoservicenet-theme_SERVLET_CONTEXT_/templates/portal_normal.vm[line 2, column 1]
        ERROR IncludeTag
      • Current URL /home generates exception: org.apache.velocity.exception.ResourceNotFoundException:
        Unable to find resource 'SERVLET_CONTEXT/html/themes/_unstyled/templates/init.vm'

      Content of the Map<String, ServletContext> _pool in the VelocityContextPool:
      {
      web-form-portlet=org.apache.catalina.core.ApplicationContextFacade@1c31971,
      sevencogs-theme=org.apache.catalina.core.ApplicationContextFacade@1bb54e0,
      rotating-visual-portlet=org.apache.catalina.core.ApplicationContextFacade@1c15cc3,
      =org.apache.catalina.core.ApplicationContextFacade@1da1a93,
      accountbeheer-portlet=org.apache.catalina.core.ApplicationContextFacade@1b10a2f,
      atpview-1.0.0-SNAPSHOT=org.apache.catalina.core.ApplicationContextFacade@13a804,
      prototype-portlets-1.0.0-M1-SNAPSHOT=org.apache.catalina.core.ApplicationContextFacade@7bcbc8,
      opensso-support-portlet=org.apache.catalina.core.ApplicationContextFacade@17ff230,
      nedascoservicenet-theme=org.apache.catalina.core.ApplicationContextFacade@143967
      }

        Activity

        Hide
        Karsten Frank added a comment -

        Hello everyone,

        I could finally fix the problem in our Liferay 6.0.6 by preventing to remove the ROOT-context in the PortalContextFactory._destroy(Portlet portlet) method.

        The problem was that the deployment of previously undeployed portlets that were present on a page ("... portlet currently undeployed ...") illegally removed the ROOT-Context from the ServletContextPool.

        The following change helped to fix it:

        File:
        com.liferay.portlet.PortletContextFactory

        Method:
        _destroy(Portlet portlet)

        OLD:
        ...
        ServletContextPool.remove(portletContext.getPortletContextName());
        ...

        NEW:
        ...
        // fix for loosing root context with undeployed portlets: do never delete the root servlet context
        if (Validator.isNotNull(portletContext.getPortletContextName()))
        ServletContextPool.remove(portletContext.getPortletContextName());
        ...

        Maybe this is helpful to others, our problem seems to be solved by it.

        Karsten Frank

        Show
        Karsten Frank added a comment - Hello everyone, I could finally fix the problem in our Liferay 6.0.6 by preventing to remove the ROOT-context in the PortalContextFactory._destroy(Portlet portlet) method. The problem was that the deployment of previously undeployed portlets that were present on a page ("... portlet currently undeployed ...") illegally removed the ROOT-Context from the ServletContextPool. The following change helped to fix it: File: com.liferay.portlet.PortletContextFactory Method: _destroy(Portlet portlet) OLD: ... ServletContextPool.remove(portletContext.getPortletContextName()); ... NEW: ... // fix for loosing root context with undeployed portlets: do never delete the root servlet context if (Validator.isNotNull(portletContext.getPortletContextName())) ServletContextPool.remove(portletContext.getPortletContextName()); ... Maybe this is helpful to others, our problem seems to be solved by it. Karsten Frank
        Hide
        Tammy Fong added a comment -

        Committed on:
        Portal 6.2.x GIT ID: d1e95b0fa84a0a99389b8c89cb86fa8eb2ed6dd2.

        Show
        Tammy Fong added a comment - Committed on: Portal 6.2.x GIT ID: d1e95b0fa84a0a99389b8c89cb86fa8eb2ed6dd2.
        Hide
        Sharry Shi added a comment -

        PASSED Manual Testing using the following steps:

        1. Deploy a custom portlet in a .war to the portal
        2. Login, create a page and place the custom portlet on it
        3. Undeploy the war (e.g. by removing the war from Tomcat)
        4. Go to the page again and press F5 to get a frame with "... portlet is currently not deployed...".
        5. Deploy the .war again and wait until the portlet is available again
        6. Press F5

        Reproduced on:
        Tomcat 6.0 + MySQL 5. Portal 6.0.6.

        The portal crashes with the described.

        [IncludeTag:154] org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'SERVLET_CONTEXT/html/themes/_unstyled/templates/init.vm'
        

        Only a restart helps, after the restart the deployed portlet is available again.

        Fixed on:
        Tomcat 6.0 + MySQL 5. Portal 6.0.x GIT ID: 347cb25fae3f7a19b172311187bc6f635fcfe763.
        Tomcat 7.0 + MySQL 5. Portal 6.1.x.EE GIT ID: bfa955446faddfa3001d078b298454a4bb676737.
        Tomcat 7.0 + MySQL 5. Portal 6.2.x GIT ID: 9340b5f2eb14de1f81199b44b4abe560607fe1c0.

        The redeployed portlet is available for use again.

        Show
        Sharry Shi added a comment - PASSED Manual Testing using the following steps: Deploy a custom portlet in a .war to the portal Login, create a page and place the custom portlet on it Undeploy the war (e.g. by removing the war from Tomcat) Go to the page again and press F5 to get a frame with "... portlet is currently not deployed...". Deploy the .war again and wait until the portlet is available again Press F5 Reproduced on: Tomcat 6.0 + MySQL 5. Portal 6.0.6. The portal crashes with the described. [IncludeTag:154] org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'SERVLET_CONTEXT/html/themes/_unstyled/templates/init.vm' Only a restart helps, after the restart the deployed portlet is available again. Fixed on: Tomcat 6.0 + MySQL 5. Portal 6.0.x GIT ID: 347cb25fae3f7a19b172311187bc6f635fcfe763. Tomcat 7.0 + MySQL 5. Portal 6.1.x.EE GIT ID: bfa955446faddfa3001d078b298454a4bb676737. Tomcat 7.0 + MySQL 5. Portal 6.2.x GIT ID: 9340b5f2eb14de1f81199b44b4abe560607fe1c0. The redeployed portlet is available for use again.
        Hide
        Sophia Zhang added a comment -

        Thank you Sharry for testing. Closing as "Fixed".

        Show
        Sophia Zhang added a comment - Thank you Sharry for testing. Closing as "Fixed".
        Hide
        Edward Gonzales added a comment -

        Hello everyone! We are in the process of moving component "Theme" to "Theme > Dev" in LPS. Please make the necessary adjustments to your filters. Thanks!

        Show
        Edward Gonzales added a comment - Hello everyone! We are in the process of moving component "Theme" to "Theme > Dev" in LPS. Please make the necessary adjustments to your filters. Thanks!

          People

          • Votes:
            25 Vote for this issue
            Watchers:
            22 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              2 years, 15 weeks, 3 days ago

              Development

                Structure Helper Panel