myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <>
Subject [jira] [Resolved] (MYFACES-3940) FlowScopeBeanHolder calls ApplicationContextBean on PreDestroy
Date Fri, 12 Dec 2014 23:59:13 GMT


Leonardo Uribe resolved MYFACES-3940.
       Resolution: Fixed
    Fix Version/s: 2.2.7
         Assignee: Leonardo Uribe

I have been thinking about this problem and I think we can just add a try{ }catch { } block
to get that bean and if it fails, just write a message in the log and destroy the beans without
an active FacesContext instance. Even if it is not a perfect solution from spec pespective
(spec demands a FacesContext instance should be valid on @PreDestroy), most of the time there
is not any call to FacesContext in that part. This is the best we can do, because after all
the problematic @PreDestroy call happens when the server is shutdown.

> FlowScopeBeanHolder calls ApplicationContextBean on PreDestroy
> --------------------------------------------------------------
>                 Key: MYFACES-3940
>                 URL:
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-344
>    Affects Versions: 2.2.5
>         Environment: WebSphere
>            Reporter: Sami Korhonen
>            Assignee: Leonardo Uribe
>             Fix For: 2.2.7
> Session scoped cdi bean FlowScopeBeanHolder relies on existance of ApplicationContextBean.
However, when application is shutdown there is no guarantee that application scoped bean is
destroyed after session scoped bean. Because ApplicationContextBean no longer exists, application
server to throws an exception:
> [10.11.2014 10:06:50:511 EET] 00000072 ManagedBean   E ManagedBean error An error occurred
while executing [@PreDestroy.]
>                                  javax.enterprise.context.ContextNotActiveException:
WebBeans context with scope type annotation @ApplicationScoped does not exist within current
> 	at org.apache.webbeans.container.BeanManagerImpl.getContext(
> 	at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(
> 	at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(
> 	at org.apache.myfaces.cdi.view.ApplicationContextBean_$$_javassist_28.getServletContext(ApplicationContextBean_$$
> 	at org.apache.myfaces.flow.cdi.FlowScopeBeanHolder.destroyBeansOnPreDestroy(

This message was sent by Atlassian JIRA

View raw message