Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1601

Lifecycle and session not initialized with portlets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.2.1.Final
    • 2.1.2.Final
    • None
    • None

    Description

      While trying to deploy JSF2.2/CDI porltes on Liferay 6.2 on Wildfly (#938) a NPE is thrown in WeldInitialListener.requestInitialized method :

      11:02:27,525 ERROR [default task-10][render_portlet_jsp:132] null
      java.lang.NullPointerException
      at org.jboss.weld.servlet.WeldInitialListener.requestInitialized(WeldInitialListener.java:144)
      at org.jboss.weld.servlet.WeldCrossContextFilter.doFilter(WeldCrossContextFilter.java:58)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
      at com.liferay.cdi.portlet.bridge.CDICrossContextFilter.doFilter(CDICrossContextFilter.java:49)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56)at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
      at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
      at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
      at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:229)
      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToServlet(ServletInitialHandler.java:178)
      at io.undertow.servlet.spec.RequestDispatcherImpl.include(RequestDispatcherImpl.java:275)
      at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:604)
      

      Tracking down 2.1.2.Final source code I identified that WeldCrossContextFilter creates a new instance of WeldInitialListener which has no constructors or initialization mechanism so beanManager and lifeclyce fields are null. After fixing that, another NPE is thrown because the SessionHandler hard-codes not to create the session if is still not crated. A portlet session must be created within the first render attempt.

      I created a fix for the two issues that allows the Liferay example portlet (https://github.com/liferay/liferay-faces/tree/master/demos/bridge/jsf2-cdi-portlet) render. https://github.com/parsek-doo/weld-core/compare/weld:2.1...2.1.2-portlet?expand=1

      Attachments

        Activity

          People

            rhn-engineering-jharting Jozef Hartinger
            duckslo_jira Jakob Munih (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: