Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSF 2.3: javax.faces.FacesException: Unable to find CDI BeanManager #4981

Closed
wants to merge 1 commit into from

Conversation

jbescos
Copy link
Member

@jbescos jbescos commented Oct 20, 2021

With JSF 2.3 there is one exception that does not allow the web application to start:

<Sep 30, 2020, 9:04:50,584 AM Pacific Daylight Time> <Error> <javax.enterprise.resource.webcontainer.jsf.config> <BEA-000000> <Critical error during deployment: 

javax.faces.FacesException: Unable to find CDI BeanManager
    at com.sun.faces.el.ELUtils.tryAddCDIELResolver(ELUtils.java:288)
    at com.sun.faces.el.ELUtils.buildFacesResolver(ELUtils.java:218)
    at com.sun.faces.application.ApplicationAssociate.initializeELResolverChains(ApplicationAssociate.java:467)
    at com.sun.faces.application.applicationimpl.ExpressionLanguage.performOneTimeELInitialization(ExpressionLanguage.java:188)
    at com.sun.faces.application.applicationimpl.ExpressionLanguage.getELResolver(ExpressionLanguage.java:122)
    Truncated. see log file for complete stacktrace
> 
<Sep 30, 2020, 9:04:50,587 AM Pacific Daylight Time> <Warning> <HTTP> <BEA-101162> <User defined listener com.sun.faces.config.ConfigureListener failed: java.lang.RuntimeException: javax.faces.FacesException: Unable to find CDI BeanManager.
java.lang.RuntimeException: javax.faces.FacesException: Unable to find CDI BeanManager
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:284)
    at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:719)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344)
    at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
    at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
    Truncated. see log file for complete stacktrace
Caused By: javax.faces.FacesException: Unable to find CDI BeanManager
    at com.sun.faces.el.ELUtils.tryAddCDIELResolver(ELUtils.java:288)
    at com.sun.faces.el.ELUtils.buildFacesResolver(ELUtils.java:218)
    at com.sun.faces.application.ApplicationAssociate.initializeELResolverChains(ApplicationAssociate.java:467)
    at com.sun.faces.application.applicationimpl.ExpressionLanguage.performOneTimeELInitialization(ExpressionLanguage.java:188)
    at com.sun.faces.application.applicationimpl.ExpressionLanguage.getELResolver(ExpressionLanguage.java:122)
    Truncated. see log file for complete stacktrace
> 
<Sep 30, 2020, 9:04:50,631 AM Pacific Daylight Time> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application "EmptyCDIWebApp".
weblogic.application.ModuleException: javax.faces.FacesException: Unable to find CDI BeanManager
    at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:233)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:228)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
    Truncated. see log file for complete stacktrace
Caused By: javax.faces.FacesException: Unable to find CDI BeanManager
    at com.sun.faces.el.ELUtils.tryAddCDIELResolver(ELUtils.java:288)
    at com.sun.faces.el.ELUtils.buildFacesResolver(ELUtils.java:218)
    at com.sun.faces.application.ApplicationAssociate.initializeELResolverChains(ApplicationAssociate.java:467)
    at com.sun.faces.application.applicationimpl.ExpressionLanguage.performOneTimeELInitialization(ExpressionLanguage.java:188)
    at com.sun.faces.application.applicationimpl.ExpressionLanguage.getELResolver(ExpressionLanguage.java:122)
    Truncated. see log file for complete stacktrace

It doesn’t seem to matter if we use the implicit resolver.

Applying this fix the application is working.

Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
@edbratt edbratt requested a review from arjantijms October 20, 2021 13:32
@melloware
Copy link
Contributor

I think this is already fixed for 2.3.17 with this fix: #4937

Can you check?

@jbescos
Copy link
Member Author

jbescos commented Oct 22, 2021

I have checked it, but there is still the possibility that BeanManager can still return null, if this is null CDI<Object> cdi = CDI.current();

I am not expert on this, but it looks safer to accept this change.

@arjantijms
Copy link
Contributor

If there really is no bean manager (because there is no CDI implementation present), the exception should be thrown, as a CDI implementation is required.

@arjantijms arjantijms closed this Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants