[weld-issues] [JBoss JIRA] Commented: (WELDX-44) Fix war:inplace target for Tomcat for numberguess example

Dan Allen (JIRA) jira-events at lists.jboss.org
Sun Nov 8 23:05:05 EST 2009


    [ https://jira.jboss.org/jira/browse/WELDX-44?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12493709#action_12493709 ] 

Dan Allen commented on WELDX-44:
--------------------------------

We had a chicken and egg problem here, because you need the BeanManager to get the CDI ELResolver to register with JSF, but the BeanManager won't be available if JSF starts first.

The following fix has been put in place.

The BeanManager may not have been initialized at the time JSF is initializing. Therefore, we stick in a ForwardingELResolver that delegates to the BeanManager ELResolver, which will be plugged in when it becomes available. If the ELResolver is invoked before the BeanManager is available, an IllegalStateException is thrown.

Here's the back story. We should probably report this bug in Mojarra, or take it to the spec.

What this comes down to is a bug in Mojarra. By the time the BeanManager is available, it may be too late to register the ELResolver because Mojarra fixes it's composite ELResolver chain the first time Application.getELResolver() is called (after that, it's not considering the ELResolvers registered with Application.addELResolver() any longer). That happens when the Weld listener starts after the JSF listener, which is the case on Tomcat <= 6.0.18.

Mojarra should be rebuilding it's composite resolver if a call is made to addELResolver(). The spec states that the ELResolvers must be consulted in the order in which they are registered. The only restriction is that ELResolvers cannot be registered *after* the first request has been serviced. We are registering before that time. And although the addELResolver in ApplicationImpl (Mojarra) verifies a request has not been serviced, it does not rebuild the composite EL resolver if the ELResolver is added legally. Actually, the spec isn't even really clear about the restriction about not calling addELResolver() after the first request is serviced. That is really an implied fact when you consider all other facts. It really should be stated explicitly in the JavaDoc (or, it should be allowed and the restriction removed in the impl).

> Fix war:inplace target for Tomcat for numberguess example
> ---------------------------------------------------------
>
>                 Key: WELDX-44
>                 URL: https://jira.jboss.org/jira/browse/WELDX-44
>             Project: Weld Extensions
>          Issue Type: Feature Request
>          Components: Servlet Containers
>            Reporter: Pete Muir
>            Assignee: Dan Allen
>             Fix For: Servlet Containers 1.0.0.CR3
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list