[jbossseam-issues] [JBoss JIRA] Resolved: (JBSEAM-1264) Session preDestroyContext Event causing exception

Pete Muir (JIRA) jira-events at lists.jboss.org
Fri Apr 27 18:16:30 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBSEAM-1264?page=all ]

Pete Muir resolved JBSEAM-1264.
-------------------------------

    Fix Version/s: 1.3.0.BETA1
       Resolution: Done

Thanks Keith, I've applied your fix :)

> Session preDestroyContext Event causing exception
> -------------------------------------------------
>
>                 Key: JBSEAM-1264
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1264
>             Project: JBoss Seam
>          Issue Type: Bug
>    Affects Versions: 1.2.1.GA
>            Reporter: Keith Naas
>         Assigned To: Pete Muir
>            Priority: Minor
>             Fix For: 1.3.0.BETA1
>
>
> This is probably the wrong thing to do for what we need...but we did encounter this interesting error.
> We registered an event on the preDestroyContext.SESSION where a stateless EJB is called to delete some items from a database.
>     <event type="org.jboss.seam.preDestroyContext.SESSION">
>         <action expression="#{service.releaseDocuments}"/>
>     </event>    
> When EJBs are passivated, this event appears to be kicking off.  But since the FacesContext is null, we get a NullPointerException from com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke.
> It looks like the FaceContext is null when it is called through the passivate interceptor, but it is calling the previous cachedMethodBinding which was generated when the FaceContext was not null.  
>  
> Seems like the method should be changed to something like this.
>          private javax.faces.el.MethodBinding getFacesMethodBinding(Class[] types, Object... args)
>          {
>             FacesContext context = FacesContext.getCurrentInstance();
>             if (cachedMethodBinding==null || (context == null && !(cachedMethodBinding instanceof UnifiedELMethodBinding)))
>             {
>                cachedMethodBinding = context==null ? 
>                      new UnifiedELMethodBinding(expression, types) : 
>                      context.getApplication().createMethodBinding(expression, types);
>             }
>             return cachedMethodBinding;            
>          }
> 11:54:08,526 ERROR [SimpleStatefulCache] problem passivation thread
> java.lang.RuntimeException: java.lang.NullPointerException: FacesConext -> null
> 	at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.prePassivate(LifecycleInterceptorHandler.java:160)
> 	at org.jboss.ejb3.stateful.StatefulContainer.invokePrePassivate(StatefulContainer.java:351)
> 	at org.jboss.ejb3.stateful.StatefulBeanContext.prePassivate(StatefulBeanContext.java:178)
> 	at org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersistenceManager.java:328)
> 	at org.jboss.ejb3.cache.simple.SimpleStatefulCache.passivate(SimpleStatefulCache.java:194)
> 	at org.jboss.ejb3.cache.simple.SimpleStatefulCache$SessionTimeoutTask.run(SimpleStatefulCache.java:129)
> Caused by: java.lang.NullPointerException: FacesConext -> null
> 	at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:72)
> 	at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:148)
> 	at org.jboss.seam.core.Events.raiseEvent(Events.java:63)
> 	at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:215)
> 	at org.jboss.seam.contexts.Lifecycle.endCall(Lifecycle.java:72)
> 	at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:117)
> 	at org.jboss.seam.intercept.RootInterceptor.invokeAndHandle(RootInterceptor.java:81)
> 	at org.jboss.seam.intercept.SessionBeanInterceptor.prePassivate(SessionBeanInterceptor.java:59)
> 	at sun.reflect.GeneratedMethodAccessor1059.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at org.jboss.ejb3.interceptor.LifecycleInvocationContextImpl.proceed(LifecycleInvocationContextImpl.java:131)
> 	at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.prePassivate(LifecycleInterceptorHandler.java:156)
> 	... 5 more

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

        



More information about the seam-issues mailing list