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
        Marco Beelen added a comment -

        I would like to propose to close this issue as 'Won't fix'.

        The problem with rendering the theme is cause by an hot-deploy of some 'incorrect' portlets.
        During the hot-deploy the portlets are being unregistered and registered again. Some portlets which fail to properly lookup their PortletContext, will get an empty String as the portletContextName and the PortletContextFactory will call the VelocityContextPool.remove() with that empty String.
        After that action the lookup of resources will fail due to the fact that the VelocityContextPool can't get the ServletContext for the empty String anymore.

        One common cause for these kind of problems are porltets developed with Spring. In certain circumstances the lookup of the WebApplicationContext by the PortletApplicationContextUtils fails to return an object, which is an WebApplicationContext.
        This problem was found by various people and Chew Boon Aik posted a solution in the forum with the topic: "Root context attribute is not of type WebApplicationContext"
        (http://www.liferay.com/web/guest/community/forums/-/message_boards/message/3121367)

        His solution to include the spring-context-portlet solved this problem for some of our portlets.

        I'm not sure if this is the only known cause for this problem. Whenever I notive other portlets doing the same, I will comment on this issue.

        Perhaps the PortletContextFactory and PortletHotDeployListener should be hardened to prevent any Portlet to remove the Context on which the liferay portal itself is running.

        Show
        Marco Beelen added a comment - I would like to propose to close this issue as 'Won't fix'. The problem with rendering the theme is cause by an hot-deploy of some 'incorrect' portlets. During the hot-deploy the portlets are being unregistered and registered again. Some portlets which fail to properly lookup their PortletContext, will get an empty String as the portletContextName and the PortletContextFactory will call the VelocityContextPool.remove() with that empty String. After that action the lookup of resources will fail due to the fact that the VelocityContextPool can't get the ServletContext for the empty String anymore. One common cause for these kind of problems are porltets developed with Spring. In certain circumstances the lookup of the WebApplicationContext by the PortletApplicationContextUtils fails to return an object, which is an WebApplicationContext. This problem was found by various people and Chew Boon Aik posted a solution in the forum with the topic: "Root context attribute is not of type WebApplicationContext" ( http://www.liferay.com/web/guest/community/forums/-/message_boards/message/3121367 ) His solution to include the spring-context-portlet solved this problem for some of our portlets. I'm not sure if this is the only known cause for this problem. Whenever I notive other portlets doing the same, I will comment on this issue. Perhaps the PortletContextFactory and PortletHotDeployListener should be hardened to prevent any Portlet to remove the Context on which the liferay portal itself is running.
        Hide
        Thomas Berg added a comment -

        I've seen this with Spring-based portlets as well.

        I disagree with Marco, this should be fixed if possible since we cannot rely on a portal that needs restarting if someone hot-deploys an "incorrect portlet".
        Not sure what you mean by "incorrect portlets" but if there's no obvious way of verifying that a portlet is "correct" before deploying, the portal must be able to handle this gracefully.

        Show
        Thomas Berg added a comment - I've seen this with Spring-based portlets as well. I disagree with Marco, this should be fixed if possible since we cannot rely on a portal that needs restarting if someone hot-deploys an "incorrect portlet". Not sure what you mean by "incorrect portlets" but if there's no obvious way of verifying that a portlet is "correct" before deploying, the portal must be able to handle this gracefully.
        Hide
        Dave Weitzel added a comment -

        I've seen this twice (so far) today when all I am doing is making small changes to jsp files and Language.properties in very simple portlets based on LIA examples.
        Definitely needs to be fixed. Have to restart to clear it from what I can tell

        Show
        Dave Weitzel added a comment - I've seen this twice (so far) today when all I am doing is making small changes to jsp files and Language.properties in very simple portlets based on LIA examples. Definitely needs to be fixed. Have to restart to clear it from what I can tell
        Hide
        Kyrre Myrbostad added a comment -

        WE are getting this problem alot, with different portlets - allthough it seems that spring-portlets get it more often. This makes hot-deploy unusable for production.

        Show
        Kyrre Myrbostad added a comment - WE are getting this problem alot, with different portlets - allthough it seems that spring-portlets get it more often. This makes hot-deploy unusable for production.
        Hide
        Kyrre Myrbostad added a comment -

        Also affects latest liferay 6EE (6.0.11)

        Show
        Kyrre Myrbostad added a comment - Also affects latest liferay 6EE (6.0.11)
        Hide
        Zsolt Babák added a comment -

        We also hit this one in 6.0.11 EE. And comes up when we redeploy a simple theme. Not every time though only upon every third or fourth deploy

        The theme has no portlet.xml or liferay-portlet.xml only the standard theme descriptors, so

        Mar 10, 2011 10:27:48 AM org.apache.catalina.startup.HostConfig checkResources
        INFO: Reloading context [/xxxxx-xxxxx-theme]
        10:27:48,519 INFO [PluginPackageUtil:1080] Reading plugin package for xxxxx-xxxxx-theme
        10:27:48,524 INFO [ThemeHotDeployListener:115] Unregistering themes for xxxxx-xxxxx-theme
        10:27:48,525 INFO [ThemeHotDeployListener:147] 1 theme for xxxxx-xxxxx-theme was unregistered
        10:27:48,618 INFO [PluginPackageUtil:1080] Reading plugin package for xxxxx-xxxxx-theme
        10:27:48,677 INFO [ThemeHotDeployListener:79] Registering themes for xxxxx-xxxxx-theme
        10:27:49,651 INFO [ThemeHotDeployListener:90] 1 theme for xxxxx-xxxxx-theme is available for use
        10:27:50,759 ERROR [ServletVelocityResourceListener:74] SERVLET_CONTEXT/html/themes/_unstyled/templates/init.vm is not valid because does not map to a servlet context
        10:27:50,761 ERROR [velocity:151] ResourceManager : unable to find resource 'SERVLET_CONTEXT/html/themes/_unstyled/templates/init.vm' in any resource loader.
        10:27:50,970 ERROR [velocity:151] #parse(): cannot find template 'SERVLET_CONTEXT/html/themes/unstyled/templates/init.vm', called at xxxxx-xxxxx-theme_SERVLET_CONTEXT/templates/portal_normal.vm[line 3, column 1]
        10:27:50,972 ERROR [IncludeTag:334] Current URL /web/guest/home?p_p_id=88&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&88_struts_action=%2flayout_management%2fedit_pages&_88_tabs1=public-pages&_88_redirect=%2f&_88_groupId=10157&_88_selPlid=10160 generates exception: Unable to find resource '_SERVLET_CONTEXT/html/themes/_unstyled/templates/init.vm'
        10:27:50,975 ERROR [IncludeTag:154] org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'SERVLET_CONTEXT/html/themes/_unstyled/templates/init.vm'
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354)
        at com.liferay.portal.velocity.LiferayResourceManager.getResource(LiferayResourceManager.java:48)
        at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1400)
        at org.apache.velocity.runtime.directive.Parse.render(Parse.java:198)
        at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
        at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
        at org.apache.velocity.Template.merge(Template.java:328)
        at org.apache.velocity.Template.merge(Template.java:235)
        at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:381)
        at com.liferay.portal.velocity.VelocityEngineImpl.mergeTemplate(VelocityEngineImpl.java:166)
        at com.liferay.portal.velocity.VelocityEngineImpl.mergeTemplate(VelocityEngineImpl.java:176)
        at com.liferay.portal.kernel.velocity.VelocityEngineUtil.mergeTemplate(VelocityEngineUtil.java:71)
        at com.liferay.taglib.util.ThemeUtil.includeVM(ThemeUtil.java:330)
        at com.liferay.taglib.util.ThemeUtil.include(ThemeUtil.java:76)
        at com.liferay.taglib.theme.IncludeTag.include(IncludeTag.java:38)
        at com.liferay.taglib.util.IncludeTag._doInclude(IncludeTag.java:326)
        at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:82)
        at org.apache.jsp.html.common.themes.portal_jsp._jspx_meth_liferay_002dtheme_005finclude_005f1(portal_jsp.java:777)
        at org.apache.jsp.html.common.themes.portal_jsp._jspx_meth_c_005fotherwise_005f0(portal_jsp.java:749)

        Show
        Zsolt Babák added a comment - We also hit this one in 6.0.11 EE. And comes up when we redeploy a simple theme. Not every time though only upon every third or fourth deploy The theme has no portlet.xml or liferay-portlet.xml only the standard theme descriptors, so Mar 10, 2011 10:27:48 AM org.apache.catalina.startup.HostConfig checkResources INFO: Reloading context [/xxxxx-xxxxx-theme] 10:27:48,519 INFO [PluginPackageUtil:1080] Reading plugin package for xxxxx-xxxxx-theme 10:27:48,524 INFO [ThemeHotDeployListener:115] Unregistering themes for xxxxx-xxxxx-theme 10:27:48,525 INFO [ThemeHotDeployListener:147] 1 theme for xxxxx-xxxxx-theme was unregistered 10:27:48,618 INFO [PluginPackageUtil:1080] Reading plugin package for xxxxx-xxxxx-theme 10:27:48,677 INFO [ThemeHotDeployListener:79] Registering themes for xxxxx-xxxxx-theme 10:27:49,651 INFO [ThemeHotDeployListener:90] 1 theme for xxxxx-xxxxx-theme is available for use 10:27:50,759 ERROR [ServletVelocityResourceListener:74] SERVLET_CONTEXT /html/themes/_unstyled/templates/init.vm is not valid because does not map to a servlet context 10:27:50,761 ERROR [velocity:151] ResourceManager : unable to find resource ' SERVLET_CONTEXT /html/themes/_unstyled/templates/init.vm' in any resource loader. 10:27:50,970 ERROR [velocity:151] #parse(): cannot find template ' SERVLET_CONTEXT /html/themes/ unstyled/templates/init.vm', called at xxxxx-xxxxx-theme_SERVLET_CONTEXT /templates/portal_normal.vm [line 3, column 1] 10:27:50,972 ERROR [IncludeTag:334] Current URL /web/guest/home?p_p_id=88&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view& 88_struts_action=%2flayout_management%2fedit_pages&_88_tabs1=public-pages&_88_redirect=%2f&_88_groupId=10157&_88_selPlid=10160 generates exception: Unable to find resource '_SERVLET_CONTEXT /html/themes/_unstyled/templates/init.vm' 10:27:50,975 ERROR [IncludeTag:154] org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource ' SERVLET_CONTEXT /html/themes/_unstyled/templates/init.vm' at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483) at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354) at com.liferay.portal.velocity.LiferayResourceManager.getResource(LiferayResourceManager.java:48) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1400) at org.apache.velocity.runtime.directive.Parse.render(Parse.java:198) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336) at org.apache.velocity.Template.merge(Template.java:328) at org.apache.velocity.Template.merge(Template.java:235) at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:381) at com.liferay.portal.velocity.VelocityEngineImpl.mergeTemplate(VelocityEngineImpl.java:166) at com.liferay.portal.velocity.VelocityEngineImpl.mergeTemplate(VelocityEngineImpl.java:176) at com.liferay.portal.kernel.velocity.VelocityEngineUtil.mergeTemplate(VelocityEngineUtil.java:71) at com.liferay.taglib.util.ThemeUtil.includeVM(ThemeUtil.java:330) at com.liferay.taglib.util.ThemeUtil.include(ThemeUtil.java:76) at com.liferay.taglib.theme.IncludeTag.include(IncludeTag.java:38) at com.liferay.taglib.util.IncludeTag._doInclude(IncludeTag.java:326) at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:82) at org.apache.jsp.html.common.themes.portal_jsp._jspx_meth_liferay_002dtheme_005finclude_005f1(portal_jsp.java:777) at org.apache.jsp.html.common.themes.portal_jsp._jspx_meth_c_005fotherwise_005f0(portal_jsp.java:749)
        Hide
        Nagnedra Kumar Busam added a comment -

        Any workaround to fix this issue.

        Show
        Nagnedra Kumar Busam added a comment - Any workaround to fix this issue.
        Hide
        Nagnedra Kumar Busam added a comment -

        This issue is a backlog candidate for the 100 PaperCuts program. Please consider participating! See http://liferay.com/community/100-papercuts

        Show
        Nagnedra Kumar Busam added a comment - This issue is a backlog candidate for the 100 PaperCuts program. Please consider participating! See http://liferay.com/community/100-papercuts
        Hide
        Balazs Zsoldos added a comment -

        Please read to the end as the solution is there .
        When a portlet is re-deployed and there is a page refresh at the same time Liferay servletcontext is removed from the SevletContextPool and the following error will come:

        [#|2011-05-25T07:53:02.960+0000|INFO|glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|ThreadID=87;_ThreadName=Thread-1;|07:53:02,959 ERROR [IncludeTag:154] org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '_SERVLET_CONTEXT/html/themes/_unstyled/templates/init.vm'
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354)
        at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1400)
        at org.apache.velocity.runtime.directive.Parse.render(Parse.java:198)
        at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
        at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
        at org.apache.velocity.Template.merge(Template.java:328)
        at org.apache.velocity.Template.merge(Template.java:235)
        at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:381)
        at com.liferay.portal.velocity.VelocityEngineImpl.mergeTemplate(VelocityEngineImpl.java:155)
        at com.liferay.portal.velocity.VelocityEngineImpl.mergeTemplate(VelocityEngineImpl.java:165)
        at com.liferay.portal.kernel.velocity.VelocityEngineUtil.mergeTemplate(VelocityEngineUtil.java:71)
        at com.liferay.taglib.util.ThemeUtil.includeVM(ThemeUtil.java:330)
        at com.liferay.taglib.util.ThemeUtil.include(ThemeUtil.java:76)
        at com.liferay.taglib.theme.IncludeTag.include(IncludeTag.java:38)
        at com.liferay.taglib.util.IncludeTag._doInclude(IncludeTag.java:223)
        at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:58)
        at org.apache.jsp.html.common.themes.portal_jsp._jspx_meth_liferay$1theme_include_1(portal_jsp.java from :793)
        at org.apache.jsp.html.common.themes.portal_jsp._jspx_meth_c_otherwise_0(portal_jsp.java from :766)
        at org.apache.jsp.html.common.themes.portal_jsp._jspService(portal_jsp.java from :703)

        Reason:

        When a war is loaded that contains portlet the portlets are registered to be deployed. When there is a page open when the portlets are registered but not deployed the page render itself will create a portlet instance that will start initializing the portlet as well. But this thread has the Liferay servletContext as it comes from liferay page render. After liferay realizes that this initialization was not a good idea it removes this portlet and the servletcontext that belongs to liferay with it. See the two stacktraces below. They happen at the same time:

        Here is the good deployment:

        PortletContextImpl.<init>(Portlet, ServletContext) line: 46
        PortletContextFactory._create(Portlet, ServletContext) line: 90
        PortletContextFactory.create(Portlet, ServletContext) line: 41
        PortletConfigFactoryImpl.create(Portlet, ServletContext) line: 53
        PortletConfigFactoryUtil.create(Portlet, ServletContext) line: 31
        PortletInstanceFactoryImpl.create(Portlet, ServletContext) line: 136
        PortletInstanceFactoryUtil.create(Portlet, ServletContext) line: 40
        PortletBagFactory.create(Portlet) line: 290
        PortletHotDeployListener.initPortlet(Portlet, PortletBagFactory) line: 456
        PortletHotDeployListener.doInvokeDeploy(HotDeployEvent) line: 253
        PortletHotDeployListener.invokeDeploy(HotDeployEvent) line: 101
        HotDeployUtil._doFireDeployEvent(HotDeployEvent) line: 109
        HotDeployUtil._fireDeployEvent(HotDeployEvent) line: 182
        HotDeployUtil.fireDeployEvent(HotDeployEvent) line: 38
        PortletContextListener.doPortalInit() line: 99
        PortletContextListener(BasePortalLifecycle).portalInit() line: 42
        PortalLifecycleUtil.register(PortalLifecycle) line: 52
        PortletContextListener(BasePortalLifecycle).registerPortalLifecycle() line: 50
        PortletContextListener.contextInitialized(ServletContextEvent) line: 55
        WebModule(StandardContext).contextListenerStart() line: 4690
        WebModule.contextListenerStart() line: 534
        WebModule(StandardContext).start() line: 5305
        WebModule.start() line: 500
        VirtualServer(ContainerBase).addChildInternal(Container) line: 917
        VirtualServer(ContainerBase).addChild(Container) line: 901
        VirtualServer(StandardHost).addChild(Container) line: 755
        WebContainer.loadWebModule(VirtualServer, WebModuleConfig, String, Properties) line: 1980
        WebContainer.loadWebModule(WebModuleConfig, String, Properties) line: 1630
        WebApplication.start(ApplicationContext) line: 100
        EngineRef.start(ApplicationContext, ProgressTracker) line: 130
        ModuleInfo.start(DeploymentContext, ProgressTracker) line: 269
        ApplicationInfo.start(ExtendedDeploymentContext, ProgressTracker) line: 286
        ApplicationLifecycle.deploy(Collection<Sniffer>, ExtendedDeploymentContext) line: 461
        ApplicationLoaderService.processApplication(Application, ApplicationRef, Logger) line: 364
        ApplicationLoaderService.postConstruct() line: 208
        ConstructorCreator<T>(AbstractCreatorImpl<T>).inject(Habitat, T, Inhabitant<?>) line: 131
        ConstructorCreator<T>.initialize(T, Inhabitant) line: 91
        ConstructorCreator<T>(AbstractCreatorImpl<T>).get(Inhabitant) line: 82
        SingletonInhabitant<T>.get(Inhabitant) line: 67
        LazyInhabitant<T>(EventPublishingInhabitant<T>).get(Inhabitant) line: 139
        LazyInhabitant<T>(AbstractInhabitantImpl<T>).get() line: 76
        AppServerStartup.run() line: 243
        AppServerStartup.start() line: 135
        GlassFishImpl.start() line: 79
        GlassFishMain$Launcher.launch(Properties) line: 117
        NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
        NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
        DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
        Method.invoke(Object, Object...) line: 597
        GlassFishMain.main(String[]) line: 97
        ASMain.main(String[]) line: 55

        And at the same time a page rendering happens:

        PortletContextImpl.<init>(Portlet, ServletContext) line: 46
        PortletContextFactory._create(Portlet, ServletContext) line: 90
        PortletContextFactory.create(Portlet, ServletContext) line: 41
        PortletConfigFactoryImpl.create(Portlet, ServletContext) line: 53
        PortletConfigFactoryUtil.create(Portlet, ServletContext) line: 31
        PortletInstanceFactoryImpl.create(Portlet, ServletContext) line: 136
        PortletInstanceFactoryUtil.create(Portlet, ServletContext) line: 40
        PortletBagFactory.create(Portlet) line: 290
        PortletInstanceFactoryImpl.create(Portlet, ServletContext) line: 129
        PortletInstanceFactoryUtil.create(Portlet, ServletContext) line: 40
        render_portlet.jsp line: 63
        render_005fportlet_jsp(HttpJspBase).service(HttpServletRequest, HttpServletResponse) line: 111
        render_005fportlet_jsp(HttpServlet).service(ServletRequest, ServletResponse) line: 848
        JspServletWrapper.service(HttpServletRequest, HttpServletResponse, boolean) line: 403
        JspServlet.serviceJspFile(HttpServletRequest, HttpServletResponse, String, Throwable, boolean) line: 492
        JspServlet.service(HttpServletRequest, HttpServletResponse) line: 378
        JspServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 848
        StandardWrapper.service(ServletRequest, ServletResponse, Servlet, RequestFacade) line: 1534
        ApplicationDispatcher.doInvoke(ServletRequest, ServletResponse, boolean, ApplicationDispatcher$State, RequestFacade) line: 787
        ApplicationDispatcher.invoke(ServletRequest, ServletResponse, ApplicationDispatcher$State, RequestFacade) line: 649
        ApplicationDispatcher.doInclude(ServletRequest, ServletResponse) line: 604
        ApplicationDispatcher.include(ServletRequest, ServletResponse) line: 534
        PortalImpl.renderPortlet(ServletContext, HttpServletRequest, HttpServletResponse, Portlet, String, String, Integer, Integer, String, boolean) line: 3740
        PortalUtil.renderPortlet(ServletContext, HttpServletRequest, HttpServletResponse, Portlet, String, String, Integer, Integer, String, boolean) line: 1180
        RuntimePortletUtil.processPortlet(ServletContext, HttpServletRequest, HttpServletResponse, RenderRequest, RenderResponse, Portlet, String, String, String, Integer, Integer, String, boolean) line: 160
        RuntimePortletUtil.processPortlet(ServletContext, HttpServletRequest, HttpServletResponse, Portlet, String, String, Integer, Integer, String, boolean) line: 94
        RuntimePortletUtil.processTemplate(ServletContext, HttpServletRequest, HttpServletResponse, PageContext, JspWriter, String, String, String) line: 256
        RuntimePortletUtil.processTemplate(ServletContext, HttpServletRequest, HttpServletResponse, PageContext, JspWriter, String, String) line: 181
        portlet.jsp line: 67
        portlet_jsp(HttpJspBase).service(HttpServletRequest, HttpServletResponse) line: 111
        portlet_jsp(HttpServlet).service(ServletRequest, ServletResponse) line: 848
        JspServletWrapper.service(HttpServletRequest, HttpServletResponse, boolean) line: 403
        JspServlet.serviceJspFile(HttpServletRequest, HttpServletResponse, String, Throwable, boolean) line: 492
        JspServlet.service(HttpServletRequest, HttpServletResponse) line: 378
        JspServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 848
        StandardWrapper.service(ServletRequest, ServletResponse, Servlet, RequestFacade) line: 1534
        ApplicationDispatcher.doInvoke(ServletRequest, ServletResponse, boolean, ApplicationDispatcher$State, RequestFacade) line: 787
        ApplicationDispatcher.invoke(ServletRequest, ServletResponse, ApplicationDispatcher$State, RequestFacade) line: 649
        ApplicationDispatcher.doInclude(ServletRequest, ServletResponse) line: 604
        ApplicationDispatcher.include(ServletRequest, ServletResponse) line: 534
        LayoutAction.includeLayoutContent(HttpServletRequest, HttpServletResponse, ThemeDisplay, Layout) line: 370
        LayoutAction.processLayout(ActionMapping, HttpServletRequest, HttpServletResponse, long) line: 629
        LayoutAction.execute(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) line: 232
        PortalRequestProcessor(RequestProcessor).processActionPerform(HttpServletRequest, HttpServletResponse, Action, ActionForm, ActionMapping) line: 431
        PortalRequestProcessor(RequestProcessor).process(HttpServletRequest, HttpServletResponse) line: 236
        PortalRequestProcessor.process(HttpServletRequest, HttpServletResponse) line: 153
        MainServlet(ActionServlet).process(HttpServletRequest, HttpServletResponse) line: 1196
        MainServlet(ActionServlet).doGet(HttpServletRequest, HttpServletResponse) line: 414
        MainServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 735
        MainServlet.callParentService(HttpServletRequest, HttpServletResponse) line: 508
        MainServlet.service(HttpServletRequest, HttpServletResponse) line: 485
        MainServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 848
        StandardWrapper.service(ServletRequest, ServletResponse, Servlet, RequestFacade) line: 1534
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 343
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        MonitoringFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        MonitoringFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        ValidHtmlFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        ValidHtmlFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        StripFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        StripFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 309
        StripFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        ThemePreviewFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        ThemePreviewFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        GZipFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        GZipFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        SecureFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        SecureFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 182
        SecureFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        AutoLoginFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        AutoLoginFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 254
        AutoLoginFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        ApplicationDispatcher.doInvoke(ServletRequest, ServletResponse, boolean, ApplicationDispatcher$State, RequestFacade) line: 785
        ApplicationDispatcher.invoke(ServletRequest, ServletResponse, ApplicationDispatcher$State, RequestFacade) line: 649
        ApplicationDispatcher.processRequest(ServletRequest, ServletResponse, ApplicationDispatcher$State, RequestFacade) line: 483
        ApplicationDispatcher.doDispatch(ServletRequest, ServletResponse, DispatcherType) line: 454
        ApplicationDispatcher.dispatch(ServletRequest, ServletResponse, DispatcherType) line: 350
        ApplicationDispatcher.forward(ServletRequest, ServletResponse) line: 300
        FriendlyURLServlet.service(HttpServletRequest, HttpServletResponse) line: 134
        FriendlyURLServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 848
        StandardWrapper.service(ServletRequest, ServletResponse, Servlet, RequestFacade) line: 1534
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 343
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        MonitoringFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        MonitoringFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        ValidHtmlFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        ValidHtmlFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        StripFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        StripFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 261
        StripFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        ThemePreviewFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        ThemePreviewFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        GZipFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        GZipFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        SecureFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        SecureFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 182
        SecureFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        I18nFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        I18nFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 222
        I18nFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        DoubleClickFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        DoubleClickFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        CacheFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        CacheFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 386
        CacheFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        ETagFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        ETagFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 45
        ETagFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        AutoLoginFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        AutoLoginFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 254
        AutoLoginFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        ApplicationDispatcher.doInvoke(ServletRequest, ServletResponse, boolean, ApplicationDispatcher$State, RequestFacade) line: 785
        ApplicationDispatcher.invoke(ServletRequest, ServletResponse, ApplicationDispatcher$State, RequestFacade) line: 649
        ApplicationDispatcher.processRequest(ServletRequest, ServletResponse, ApplicationDispatcher$State, RequestFacade) line: 483
        ApplicationDispatcher.doDispatch(ServletRequest, ServletResponse, DispatcherType) line: 454
        ApplicationDispatcher.dispatch(ServletRequest, ServletResponse, DispatcherType) line: 350
        ApplicationDispatcher.forward(ServletRequest, ServletResponse) line: 300
        VirtualHostFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 311
        VirtualHostFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        AuditFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        AuditFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        SessionIdFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        SessionIdFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        UrlRewriteFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 738
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        ThreadLocalFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196
        ThreadLocalFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 35
        ThreadLocalFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123
        ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215
        StandardWrapperValve.invoke(Request, Response) line: 279
        StandardContextValve.invoke(Request, Response) line: 175
        PESessionLockingStandardPipeline(StandardPipeline).doInvoke(Request, Response, boolean) line: 655
        PESessionLockingStandardPipeline(StandardPipeline).invoke(Request, Response) line: 595
        PESessionLockingStandardPipeline(WebPipeline).invoke(Request, Response) line: 98
        PESessionLockingStandardPipeline.invoke(Request, Response) line: 91
        StandardHostValve.invoke(Request, Response) line: 162
        CoyoteAdapter.doService(Request, Request, Response, Response) line: 326
        CoyoteAdapter.service(Request, Response) line: 227
        ContainerMapper.service(Request, Response) line: 170
        ProcessorTask.invokeAdapter() line: 822
        ProcessorTask.doProcess() line: 719
        ProcessorTask.process(InputStream, OutputStream) line: 1013
        DefaultProtocolFilter.execute(Context) line: 225
        HttpProtocolChain(DefaultProtocolChain).executeProtocolFilter(Context, int) line: 137
        HttpProtocolChain(DefaultProtocolChain).execute(Context, int) line: 104
        HttpProtocolChain(DefaultProtocolChain).execute(Context) line: 90
        HttpProtocolChain.execute(Context) line: 79
        ProtocolChainContextTask.doCall() line: 54
        ProtocolChainContextTask(SelectionKeyContextTask).call() line: 59
        ProtocolChainContextTask(ContextTask).run() line: 71
        FixedThreadPool$BasicWorker(AbstractThreadPool$Worker).doWork() line: 532
        FixedThreadPool$BasicWorker(AbstractThreadPool$Worker).run() line: 513
        HttpWorkerThread(Thread).run() line: 662

        The second stacktrace causes the problem. Even worse that as Velocity or some other technology uses a cache the exception will start coming after a while when nobody opened the portal page.

        When liferay starts on a windows system it opens up a browser and opens the starting page. It very often happens that this page opens up when a the custom portlets are under deployment. If the page contains a custom portlet the portal will be killed (after a while when the cache takes out the vm files).

        Reproduce:

        • Start liferay with a custom portlet in a war.
        • Until its starting connect with a debugger and place a breakpoint into PortletContextImpl.java:46
        • First the debugging will stop many times when liferay portlets are initializing. These are not important.
        • Second the war portlet will initialize. When this happens stop that thread and open a portal page in a browser where this portlet is placed out.
        • The portal is killed.

        Possible solution:

        • Create a static ThreadLocal variable in a class that says if the portlet is under deployment or not. This means that in MainServlet.init() before calling initPortlets() we place into the ThreadLocal variable true and after it returned we place a false. We do the same in HotDeployUtil.fireDeployEvent(HotDeployEvent) method.
        • In the class PortletInstanceFactoryImpl line 108 we place into the "if" statement a check if the value of the mentioned ThreadLocal variable is true. This line is the following:
          if (instanceInvokerPortletInstance == null)
        • if instanceInvoker... is null but we are not in a deployment thread we of course throw an exception.

        With the solution we can be sure that the deployment of the portlet is only done when we are really deploying the portlet and not when it is registered but not deployed yet.

        Show
        Balazs Zsoldos added a comment - Please read to the end as the solution is there . When a portlet is re-deployed and there is a page refresh at the same time Liferay servletcontext is removed from the SevletContextPool and the following error will come: [#|2011-05-25T07:53:02.960+0000|INFO|glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging| ThreadID=87;_ThreadName=Thread-1;|07:53:02,959 ERROR [IncludeTag:154] org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '_SERVLET_CONTEXT /html/themes/_unstyled/templates/init.vm' at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483) at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1400) at org.apache.velocity.runtime.directive.Parse.render(Parse.java:198) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336) at org.apache.velocity.Template.merge(Template.java:328) at org.apache.velocity.Template.merge(Template.java:235) at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:381) at com.liferay.portal.velocity.VelocityEngineImpl.mergeTemplate(VelocityEngineImpl.java:155) at com.liferay.portal.velocity.VelocityEngineImpl.mergeTemplate(VelocityEngineImpl.java:165) at com.liferay.portal.kernel.velocity.VelocityEngineUtil.mergeTemplate(VelocityEngineUtil.java:71) at com.liferay.taglib.util.ThemeUtil.includeVM(ThemeUtil.java:330) at com.liferay.taglib.util.ThemeUtil.include(ThemeUtil.java:76) at com.liferay.taglib.theme.IncludeTag.include(IncludeTag.java:38) at com.liferay.taglib.util.IncludeTag._doInclude(IncludeTag.java:223) at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:58) at org.apache.jsp.html.common.themes.portal_jsp._jspx_meth_liferay$1theme_include_1(portal_jsp.java from :793) at org.apache.jsp.html.common.themes.portal_jsp._jspx_meth_c_otherwise_0(portal_jsp.java from :766) at org.apache.jsp.html.common.themes.portal_jsp._jspService(portal_jsp.java from :703) Reason: When a war is loaded that contains portlet the portlets are registered to be deployed. When there is a page open when the portlets are registered but not deployed the page render itself will create a portlet instance that will start initializing the portlet as well. But this thread has the Liferay servletContext as it comes from liferay page render. After liferay realizes that this initialization was not a good idea it removes this portlet and the servletcontext that belongs to liferay with it. See the two stacktraces below. They happen at the same time: Here is the good deployment: PortletContextImpl.<init>(Portlet, ServletContext) line: 46 PortletContextFactory._create(Portlet, ServletContext) line: 90 PortletContextFactory.create(Portlet, ServletContext) line: 41 PortletConfigFactoryImpl.create(Portlet, ServletContext) line: 53 PortletConfigFactoryUtil.create(Portlet, ServletContext) line: 31 PortletInstanceFactoryImpl.create(Portlet, ServletContext) line: 136 PortletInstanceFactoryUtil.create(Portlet, ServletContext) line: 40 PortletBagFactory.create(Portlet) line: 290 PortletHotDeployListener.initPortlet(Portlet, PortletBagFactory) line: 456 PortletHotDeployListener.doInvokeDeploy(HotDeployEvent) line: 253 PortletHotDeployListener.invokeDeploy(HotDeployEvent) line: 101 HotDeployUtil._doFireDeployEvent(HotDeployEvent) line: 109 HotDeployUtil._fireDeployEvent(HotDeployEvent) line: 182 HotDeployUtil.fireDeployEvent(HotDeployEvent) line: 38 PortletContextListener.doPortalInit() line: 99 PortletContextListener(BasePortalLifecycle).portalInit() line: 42 PortalLifecycleUtil.register(PortalLifecycle) line: 52 PortletContextListener(BasePortalLifecycle).registerPortalLifecycle() line: 50 PortletContextListener.contextInitialized(ServletContextEvent) line: 55 WebModule(StandardContext).contextListenerStart() line: 4690 WebModule.contextListenerStart() line: 534 WebModule(StandardContext).start() line: 5305 WebModule.start() line: 500 VirtualServer(ContainerBase).addChildInternal(Container) line: 917 VirtualServer(ContainerBase).addChild(Container) line: 901 VirtualServer(StandardHost).addChild(Container) line: 755 WebContainer.loadWebModule(VirtualServer, WebModuleConfig, String, Properties) line: 1980 WebContainer.loadWebModule(WebModuleConfig, String, Properties) line: 1630 WebApplication.start(ApplicationContext) line: 100 EngineRef.start(ApplicationContext, ProgressTracker) line: 130 ModuleInfo.start(DeploymentContext, ProgressTracker) line: 269 ApplicationInfo.start(ExtendedDeploymentContext, ProgressTracker) line: 286 ApplicationLifecycle.deploy(Collection<Sniffer>, ExtendedDeploymentContext) line: 461 ApplicationLoaderService.processApplication(Application, ApplicationRef, Logger) line: 364 ApplicationLoaderService.postConstruct() line: 208 ConstructorCreator<T>(AbstractCreatorImpl<T>).inject(Habitat, T, Inhabitant<?>) line: 131 ConstructorCreator<T>.initialize(T, Inhabitant) line: 91 ConstructorCreator<T>(AbstractCreatorImpl<T>).get(Inhabitant) line: 82 SingletonInhabitant<T>.get(Inhabitant) line: 67 LazyInhabitant<T>(EventPublishingInhabitant<T>).get(Inhabitant) line: 139 LazyInhabitant<T>(AbstractInhabitantImpl<T>).get() line: 76 AppServerStartup.run() line: 243 AppServerStartup.start() line: 135 GlassFishImpl.start() line: 79 GlassFishMain$Launcher.launch(Properties) line: 117 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 GlassFishMain.main(String[]) line: 97 ASMain.main(String[]) line: 55 And at the same time a page rendering happens: PortletContextImpl.<init>(Portlet, ServletContext) line: 46 PortletContextFactory._create(Portlet, ServletContext) line: 90 PortletContextFactory.create(Portlet, ServletContext) line: 41 PortletConfigFactoryImpl.create(Portlet, ServletContext) line: 53 PortletConfigFactoryUtil.create(Portlet, ServletContext) line: 31 PortletInstanceFactoryImpl.create(Portlet, ServletContext) line: 136 PortletInstanceFactoryUtil.create(Portlet, ServletContext) line: 40 PortletBagFactory.create(Portlet) line: 290 PortletInstanceFactoryImpl.create(Portlet, ServletContext) line: 129 PortletInstanceFactoryUtil.create(Portlet, ServletContext) line: 40 render_portlet.jsp line: 63 render_005fportlet_jsp(HttpJspBase).service(HttpServletRequest, HttpServletResponse) line: 111 render_005fportlet_jsp(HttpServlet).service(ServletRequest, ServletResponse) line: 848 JspServletWrapper.service(HttpServletRequest, HttpServletResponse, boolean) line: 403 JspServlet.serviceJspFile(HttpServletRequest, HttpServletResponse, String, Throwable, boolean) line: 492 JspServlet.service(HttpServletRequest, HttpServletResponse) line: 378 JspServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 848 StandardWrapper.service(ServletRequest, ServletResponse, Servlet, RequestFacade) line: 1534 ApplicationDispatcher.doInvoke(ServletRequest, ServletResponse, boolean, ApplicationDispatcher$State, RequestFacade) line: 787 ApplicationDispatcher.invoke(ServletRequest, ServletResponse, ApplicationDispatcher$State, RequestFacade) line: 649 ApplicationDispatcher.doInclude(ServletRequest, ServletResponse) line: 604 ApplicationDispatcher.include(ServletRequest, ServletResponse) line: 534 PortalImpl.renderPortlet(ServletContext, HttpServletRequest, HttpServletResponse, Portlet, String, String, Integer, Integer, String, boolean) line: 3740 PortalUtil.renderPortlet(ServletContext, HttpServletRequest, HttpServletResponse, Portlet, String, String, Integer, Integer, String, boolean) line: 1180 RuntimePortletUtil.processPortlet(ServletContext, HttpServletRequest, HttpServletResponse, RenderRequest, RenderResponse, Portlet, String, String, String, Integer, Integer, String, boolean) line: 160 RuntimePortletUtil.processPortlet(ServletContext, HttpServletRequest, HttpServletResponse, Portlet, String, String, Integer, Integer, String, boolean) line: 94 RuntimePortletUtil.processTemplate(ServletContext, HttpServletRequest, HttpServletResponse, PageContext, JspWriter, String, String, String) line: 256 RuntimePortletUtil.processTemplate(ServletContext, HttpServletRequest, HttpServletResponse, PageContext, JspWriter, String, String) line: 181 portlet.jsp line: 67 portlet_jsp(HttpJspBase).service(HttpServletRequest, HttpServletResponse) line: 111 portlet_jsp(HttpServlet).service(ServletRequest, ServletResponse) line: 848 JspServletWrapper.service(HttpServletRequest, HttpServletResponse, boolean) line: 403 JspServlet.serviceJspFile(HttpServletRequest, HttpServletResponse, String, Throwable, boolean) line: 492 JspServlet.service(HttpServletRequest, HttpServletResponse) line: 378 JspServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 848 StandardWrapper.service(ServletRequest, ServletResponse, Servlet, RequestFacade) line: 1534 ApplicationDispatcher.doInvoke(ServletRequest, ServletResponse, boolean, ApplicationDispatcher$State, RequestFacade) line: 787 ApplicationDispatcher.invoke(ServletRequest, ServletResponse, ApplicationDispatcher$State, RequestFacade) line: 649 ApplicationDispatcher.doInclude(ServletRequest, ServletResponse) line: 604 ApplicationDispatcher.include(ServletRequest, ServletResponse) line: 534 LayoutAction.includeLayoutContent(HttpServletRequest, HttpServletResponse, ThemeDisplay, Layout) line: 370 LayoutAction.processLayout(ActionMapping, HttpServletRequest, HttpServletResponse, long) line: 629 LayoutAction.execute(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) line: 232 PortalRequestProcessor(RequestProcessor).processActionPerform(HttpServletRequest, HttpServletResponse, Action, ActionForm, ActionMapping) line: 431 PortalRequestProcessor(RequestProcessor).process(HttpServletRequest, HttpServletResponse) line: 236 PortalRequestProcessor.process(HttpServletRequest, HttpServletResponse) line: 153 MainServlet(ActionServlet).process(HttpServletRequest, HttpServletResponse) line: 1196 MainServlet(ActionServlet).doGet(HttpServletRequest, HttpServletResponse) line: 414 MainServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 735 MainServlet.callParentService(HttpServletRequest, HttpServletResponse) line: 508 MainServlet.service(HttpServletRequest, HttpServletResponse) line: 485 MainServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 848 StandardWrapper.service(ServletRequest, ServletResponse, Servlet, RequestFacade) line: 1534 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 343 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 MonitoringFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 MonitoringFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 ValidHtmlFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 ValidHtmlFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 StripFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 StripFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 309 StripFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 ThemePreviewFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 ThemePreviewFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 GZipFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 GZipFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 SecureFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 SecureFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 182 SecureFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 AutoLoginFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 AutoLoginFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 254 AutoLoginFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 ApplicationDispatcher.doInvoke(ServletRequest, ServletResponse, boolean, ApplicationDispatcher$State, RequestFacade) line: 785 ApplicationDispatcher.invoke(ServletRequest, ServletResponse, ApplicationDispatcher$State, RequestFacade) line: 649 ApplicationDispatcher.processRequest(ServletRequest, ServletResponse, ApplicationDispatcher$State, RequestFacade) line: 483 ApplicationDispatcher.doDispatch(ServletRequest, ServletResponse, DispatcherType) line: 454 ApplicationDispatcher.dispatch(ServletRequest, ServletResponse, DispatcherType) line: 350 ApplicationDispatcher.forward(ServletRequest, ServletResponse) line: 300 FriendlyURLServlet.service(HttpServletRequest, HttpServletResponse) line: 134 FriendlyURLServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 848 StandardWrapper.service(ServletRequest, ServletResponse, Servlet, RequestFacade) line: 1534 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 343 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 MonitoringFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 MonitoringFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 ValidHtmlFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 ValidHtmlFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 StripFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 StripFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 261 StripFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 ThemePreviewFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 ThemePreviewFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 GZipFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 GZipFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 SecureFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 SecureFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 182 SecureFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 I18nFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 I18nFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 222 I18nFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 DoubleClickFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 DoubleClickFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 CacheFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 CacheFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 386 CacheFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 ETagFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 ETagFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 45 ETagFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 AutoLoginFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 AutoLoginFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 254 AutoLoginFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 ApplicationDispatcher.doInvoke(ServletRequest, ServletResponse, boolean, ApplicationDispatcher$State, RequestFacade) line: 785 ApplicationDispatcher.invoke(ServletRequest, ServletResponse, ApplicationDispatcher$State, RequestFacade) line: 649 ApplicationDispatcher.processRequest(ServletRequest, ServletResponse, ApplicationDispatcher$State, RequestFacade) line: 483 ApplicationDispatcher.doDispatch(ServletRequest, ServletResponse, DispatcherType) line: 454 ApplicationDispatcher.dispatch(ServletRequest, ServletResponse, DispatcherType) line: 350 ApplicationDispatcher.forward(ServletRequest, ServletResponse) line: 300 VirtualHostFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 311 VirtualHostFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 AuditFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 AuditFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 SessionIdFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 SessionIdFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 126 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 UrlRewriteFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 738 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 ThreadLocalFilter(BaseFilter).processFilter(Class<?>, HttpServletRequest, HttpServletResponse, FilterChain) line: 196 ThreadLocalFilter.processFilter(HttpServletRequest, HttpServletResponse, FilterChain) line: 35 ThreadLocalFilter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 123 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 215 StandardWrapperValve.invoke(Request, Response) line: 279 StandardContextValve.invoke(Request, Response) line: 175 PESessionLockingStandardPipeline(StandardPipeline).doInvoke(Request, Response, boolean) line: 655 PESessionLockingStandardPipeline(StandardPipeline).invoke(Request, Response) line: 595 PESessionLockingStandardPipeline(WebPipeline).invoke(Request, Response) line: 98 PESessionLockingStandardPipeline.invoke(Request, Response) line: 91 StandardHostValve.invoke(Request, Response) line: 162 CoyoteAdapter.doService(Request, Request, Response, Response) line: 326 CoyoteAdapter.service(Request, Response) line: 227 ContainerMapper.service(Request, Response) line: 170 ProcessorTask.invokeAdapter() line: 822 ProcessorTask.doProcess() line: 719 ProcessorTask.process(InputStream, OutputStream) line: 1013 DefaultProtocolFilter.execute(Context) line: 225 HttpProtocolChain(DefaultProtocolChain).executeProtocolFilter(Context, int) line: 137 HttpProtocolChain(DefaultProtocolChain).execute(Context, int) line: 104 HttpProtocolChain(DefaultProtocolChain).execute(Context) line: 90 HttpProtocolChain.execute(Context) line: 79 ProtocolChainContextTask.doCall() line: 54 ProtocolChainContextTask(SelectionKeyContextTask).call() line: 59 ProtocolChainContextTask(ContextTask).run() line: 71 FixedThreadPool$BasicWorker(AbstractThreadPool$Worker).doWork() line: 532 FixedThreadPool$BasicWorker(AbstractThreadPool$Worker).run() line: 513 HttpWorkerThread(Thread).run() line: 662 The second stacktrace causes the problem. Even worse that as Velocity or some other technology uses a cache the exception will start coming after a while when nobody opened the portal page. When liferay starts on a windows system it opens up a browser and opens the starting page. It very often happens that this page opens up when a the custom portlets are under deployment. If the page contains a custom portlet the portal will be killed (after a while when the cache takes out the vm files). Reproduce: Start liferay with a custom portlet in a war. Until its starting connect with a debugger and place a breakpoint into PortletContextImpl.java:46 First the debugging will stop many times when liferay portlets are initializing. These are not important. Second the war portlet will initialize. When this happens stop that thread and open a portal page in a browser where this portlet is placed out. The portal is killed. Possible solution: Create a static ThreadLocal variable in a class that says if the portlet is under deployment or not. This means that in MainServlet.init() before calling initPortlets() we place into the ThreadLocal variable true and after it returned we place a false. We do the same in HotDeployUtil.fireDeployEvent(HotDeployEvent) method. In the class PortletInstanceFactoryImpl line 108 we place into the "if" statement a check if the value of the mentioned ThreadLocal variable is true. This line is the following: if (instanceInvokerPortletInstance == null) if instanceInvoker... is null but we are not in a deployment thread we of course throw an exception. With the solution we can be sure that the deployment of the portlet is only done when we are really deploying the portlet and not when it is registered but not deployed yet.
        Hide
        David Coleman added a comment -

        This is also raised in http://issues.liferay.com/browse/LPS-12202. This issue is affecting a lot of people and it is affecting me across dev, test and production. Our customer system is on RHEL6/mySQL and our systems are a mix of windows and centos. GE6.0.5 but saw it also on previous versions.

        The solution design above (and analysis) is the most detailed that I have seen so far - any comment from Liferay team on whether this can be fixed?

        Show
        David Coleman added a comment - This is also raised in http://issues.liferay.com/browse/LPS-12202 . This issue is affecting a lot of people and it is affecting me across dev, test and production. Our customer system is on RHEL6/mySQL and our systems are a mix of windows and centos. GE6.0.5 but saw it also on previous versions. The solution design above (and analysis) is the most detailed that I have seen so far - any comment from Liferay team on whether this can be fixed?
        Hide
        Balazs Zsoldos added a comment -

        During development and testing the following might help:

        • Do not place any portlet on the opening page that is placed into a WAR! When Liferay starts it opens up the opening page in a browser and you have about 90% that this error will occur. The problem will come out after you come back from the toilet and the cache gets empty
        • On the production server if you have to have a WAR portlet on the opening page be sure that liferay does not open this up automatically after a start in a browser. For example on linux systems without X it cannot happen.
        Show
        Balazs Zsoldos added a comment - During development and testing the following might help: Do not place any portlet on the opening page that is placed into a WAR! When Liferay starts it opens up the opening page in a browser and you have about 90% that this error will occur. The problem will come out after you come back from the toilet and the cache gets empty On the production server if you have to have a WAR portlet on the opening page be sure that liferay does not open this up automatically after a start in a browser. For example on linux systems without X it cannot happen.
        Hide
        Raymond Auge added a comment -

        Please retest this issue as I cannot reproduce in 6.0.x at svn Revision: 82592.

        Show
        Raymond Auge added a comment - Please retest this issue as I cannot reproduce in 6.0.x at svn Revision: 82592.
        Hide
        Kyrre Myrbostad added a comment -

        This is a major issue for us, as it prevents any kind of hot-deploy. It is easily reproduced on 6.0.11:
        1. Make a custom theme
        2. Make a custom portlet
        3. Put the custom portlet on the front page of the portal
        4. Redeploy the portlet while spamming F5 on the front page

        Voila: The portal context is removed and no page external page is accesible (while you can still use the control panel)

        It seems this issue is not going to make it into 6.0.12. Please reconsider that, as there seems to be a solution ready!

        Show
        Kyrre Myrbostad added a comment - This is a major issue for us, as it prevents any kind of hot-deploy. It is easily reproduced on 6.0.11: 1. Make a custom theme 2. Make a custom portlet 3. Put the custom portlet on the front page of the portal 4. Redeploy the portlet while spamming F5 on the front page Voila: The portal context is removed and no page external page is accesible (while you can still use the control panel) It seems this issue is not going to make it into 6.0.12. Please reconsider that, as there seems to be a solution ready!
        Hide
        Igor Kim added a comment -

        We have faced the similar problem with WSRP portlets too.

        Show
        Igor Kim added a comment - We have faced the similar problem with WSRP portlets too.
        Hide
        Solo added a comment -

        I have the same issue. The only extra portlet installed: web-form-portlet

        Show
        Solo added a comment - I have the same issue. The only extra portlet installed: web-form-portlet
        Hide
        Miguel Coxo added a comment -

        Hi there,

        I'm using liferay 6.0.6 and this error occurs both in my machine (OSX 10.7.2) and on our dev machines (centOS 6).

        We have a custom theme, hook and portlets. If you deploy the theme or the portlets and try to access the site you will get this error.

        This is a huge problem as it makes the system unreliable.

        It seems Balazs Zsoldos has a possible solution. Has anyone tried it?

        Show
        Miguel Coxo added a comment - Hi there, I'm using liferay 6.0.6 and this error occurs both in my machine (OSX 10.7.2) and on our dev machines (centOS 6). We have a custom theme, hook and portlets. If you deploy the theme or the portlets and try to access the site you will get this error. This is a huge problem as it makes the system unreliable. It seems Balazs Zsoldos has a possible solution. Has anyone tried it?
        Hide
        Karsten Frank added a comment -

        Hello everyone,

        we have exactly this problem quite often with Liferay 6.0.6.

        After trying to find the exact conditions to reproduce the problem, I finally succeeded.

        Here is one reliable way to reproduce the problem:

        1.) deploy and use a custom theme
        2.) deploy a custom portlet in a .war to the portal
        3.) login, create a page and place the custom portlet on it
        4.) undeploy the war (e.g. by removing the war from Tomcat)
        5.) go to the page again and press F5 to get a frame with "... portlet is currently not deployed...".
        It seems to be important that Liferay sees once that the portlet is currently not available.
        6.) deploy the .war again and wait until the portlet is available again
        7.) change to another page or press F5

        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.

        Can you please consider a fix since this crashes the whole portal?

        Thank you very much!

        Karsten Frank

        Show
        Karsten Frank added a comment - Hello everyone, we have exactly this problem quite often with Liferay 6.0.6. After trying to find the exact conditions to reproduce the problem, I finally succeeded. Here is one reliable way to reproduce the problem: 1.) deploy and use a custom theme 2.) deploy a custom portlet in a .war to the portal 3.) login, create a page and place the custom portlet on it 4.) undeploy the war (e.g. by removing the war from Tomcat) 5.) go to the page again and press F5 to get a frame with "... portlet is currently not deployed...". It seems to be important that Liferay sees once that the portlet is currently not available. 6.) deploy the .war again and wait until the portlet is available again 7.) change to another page or press F5 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. Can you please consider a fix since this crashes the whole portal? Thank you very much! Karsten Frank
        Hide
        Harilal added a comment -

        this type of theme errors are commonly getting while trying to implement customized themes. In the case of customized theme, check the content of init_cutom.vm (in \templates) file. If there is no content type the following
        #set ($show_toggle_controls = false)

        #set ($liferay_toggle_controls = $sessionClicks.get($request, "liferay_toggle_controls", "visible"))

        #if ($liferay_toggle_controls == "visible")
        #set ($css_class = $css_class + " controls-visible")
        #else
        #set ($css_class = $css_class + " controls-visible")
        #end
        and then save the file. rebuild the theme. Then deploy the new theme and restart the server. hope this will solve the error...

        Show
        Harilal added a comment - this type of theme errors are commonly getting while trying to implement customized themes. In the case of customized theme, check the content of init_cutom.vm (in \templates) file. If there is no content type the following #set ($show_toggle_controls = false) #set ($liferay_toggle_controls = $sessionClicks.get($request, "liferay_toggle_controls", "visible")) #if ($liferay_toggle_controls == "visible") #set ($css_class = $css_class + " controls-visible") #else #set ($css_class = $css_class + " controls-visible") #end and then save the file. rebuild the theme. Then deploy the new theme and restart the server. hope this will solve the error...
        Hide
        Harilal added a comment -

        This type of theme errors are commonly getting while trying to implement customized themes. In the case of customized theme, check the content of init_cutom.vm (in \templates) file. If there is no content type the following
        #set ($show_toggle_controls = false)

        #set ($liferay_toggle_controls = $sessionClicks.get($request, "liferay_toggle_controls", "visible"))

        #if ($liferay_toggle_controls == "visible")
        #set ($css_class = $css_class + " controls-visible")
        #else
        #set ($css_class = $css_class + " controls-visible")
        #end
        and then save the file. rebuild the theme. Then deploy the new theme and restart the server. hope this will solve the error...

        Show
        Harilal added a comment - This type of theme errors are commonly getting while trying to implement customized themes. In the case of customized theme, check the content of init_cutom.vm (in \templates) file. If there is no content type the following #set ($show_toggle_controls = false) #set ($liferay_toggle_controls = $sessionClicks.get($request, "liferay_toggle_controls", "visible")) #if ($liferay_toggle_controls == "visible") #set ($css_class = $css_class + " controls-visible") #else #set ($css_class = $css_class + " controls-visible") #end and then save the file. rebuild the theme. Then deploy the new theme and restart the server. hope this will solve the error...
        Hide
        Marco Beelen added a comment -

        I reopened the issue since the cause of this issue is NOT the content of any custom theme itself.

        The cause of the problem is that the Map<String,ServletContext> within the VelocityContextPool gets modified during a hot-deploy of a theme or portlets. (A war removes and re-inserts itself into that MAp)
        If a request hits the portal, which needs the custom theme or portlet, during the deployment procedure the content of that Map gets corrupted by removal of the ROOT context.

        This issue suggests an improvement to the VelocityContextPool, so that it initially detects the ROOT context and prevent that key from being removed from the map.

        Show
        Marco Beelen added a comment - I reopened the issue since the cause of this issue is NOT the content of any custom theme itself. The cause of the problem is that the Map<String,ServletContext> within the VelocityContextPool gets modified during a hot-deploy of a theme or portlets. (A war removes and re-inserts itself into that MAp) If a request hits the portal, which needs the custom theme or portlet, during the deployment procedure the content of that Map gets corrupted by removal of the ROOT context. This issue suggests an improvement to the VelocityContextPool, so that it initially detects the ROOT context and prevent that key from being removed from the map.
        Hide
        Ivo Neskovic added a comment -

        Hi Marco,

        I modified my local VelocityContextPool to detect the ROOT context and prevent that key from being removed from the map, but the issue still happens and I have noticed that the remove(String servletContextKey) is actually never called!

        Does this make any sense?
        This is a very urgent issue for me and our deployment, I am ready to bugfix whatever I can to get this one working

        /Ivo

        Show
        Ivo Neskovic added a comment - Hi Marco, I modified my local VelocityContextPool to detect the ROOT context and prevent that key from being removed from the map, but the issue still happens and I have noticed that the remove(String servletContextKey) is actually never called! Does this make any sense? This is a very urgent issue for me and our deployment, I am ready to bugfix whatever I can to get this one working /Ivo
        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, 16 weeks ago

              Development

                Structure Helper Panel