Issue Type: Bug Bug
Affects Versions: 2.1.2.Final
Assignee: Jozef Hartinger
Created: 07/Feb/14 6:01 PM
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.NullPointerExceptionat 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)

Tacking 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

Environment: WildFly 8, linux 3.11.0-15-generic, lifery 6.2
Project: Weld
Priority: Major Major
Reporter: Jakob Munih
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira