tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: session expiration upon undeploy vs. cdi
Date Sun, 26 Feb 2017 12:24:41 GMT
Yes, depends the session manager impl there. It has several pitfalls like
breaking distribution etc so best is to remove it likely through a flag and
observe shutdown event for the final destruction if needed.


Le 26 févr. 2017 12:48, "Tamás Kimmel" <kumm0307@gmail.com> a écrit :

> Hi, I'm implementing a custom CDI context storing itself in session.
> On session expiration my context should destroy all active contextual
> instances.
>
> I've run into an issue after turned off session serialization.
> ( with a context.xml contains <Manager pathname="" />)
>
> Upon undeploy tomcat expires all sessions ( as it should ), but I get an
> exception.
> beanManager.getPassivationCapableBean can't find my bean, and it causes an
> NPE in deltaspike AbstractContext.destroyBean.
> It seems to me application beans are undeployed already when session
> expiration event fired. I've found even my context is lost at this point,
> beanManager.getContext() fails.
>
> An example project can be found here: https://github.com/kumm/mycdicontext
> 'mvn test' is green but predestroy don't run ('++ HelloBean preDestroy ++'
> should appear in the log), and exception is logged.
>
> Running with -Pwildfly, or -Pglassfish it's working.
> Maybe it's something implementation specific and my approach is wrong?
>
> Thanks in advance,
> Kimmel Tamás
>
> Stacktrace below:
>
> 26-Feb-2017 12:03:28.209 INFO [http-nio-8080-exec-6]
> org.apache.openejb.assembler.classic.Assembler.destroyApplication
> Undeploying app:
> /home/kumm/Workspace/Projects/tomeecditest/target/tomee/wd/
> 0/eb577be1-a135-4f7d-bd6e-01ea88695d21
> 26-Feb-2017 12:03:28.216 SEVERE [http-nio-8080-exec-6]
> org.apache.webbeans.component.AbstractOwbBean.destroy Exception thrown
> while destroying bean instance : [StorageRepository, WebBeansType:MANAGED,
> Name:null, API
> Types:[java.lang.Object,java.io.Serializable,trial.mycontext.MyContext$
> StorageRepository],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>  java.lang.NullPointerException
>     at
> org.apache.deltaspike.core.util.context.AbstractContext.
> destroyBean(AbstractContext.java:202)
>     at
> org.apache.deltaspike.core.util.context.AbstractContext.destroyAllActive(
> AbstractContext.java:195)
>     at
> trial.mycontext.MyContext$StorageRepository.destroy(MyContext.java:60)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 62)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:497)
>     at
> org.apache.webbeans.intercept.LifecycleInterceptorInvocation
> Context.proceed(LifecycleInterceptorInvocationContext.java:103)
>     at
> org.apache.webbeans.portable.InjectionTargetImpl.preDestroy(
> InjectionTargetImpl.java:352)
>     at
> org.apache.webbeans.component.AbstractOwbBean.destroy(
> AbstractOwbBean.java:179)
>     at
> org.apache.webbeans.context.AbstractContext.destroyInstance(
> AbstractContext.java:206)
>     at
> org.apache.webbeans.context.AbstractContext.destroyInstance(
> AbstractContext.java:192)
>     at
> org.apache.webbeans.context.AbstractContext.destroy(
> AbstractContext.java:218)
>     at
> org.apache.webbeans.web.context.WebContextsService.destroySessionContext(
> WebContextsService.java:547)
>     at
> org.apache.webbeans.web.context.WebContextsService.
> endContext(WebContextsService.java:227)
>     at
> org.apache.openejb.server.httpd.BeginWebBeansListener.sessionDestroyed(
> BeginWebBeansListener.java:170)
>     at
> org.apache.catalina.session.StandardSession.expire(
> StandardSession.java:824)
>     at
> org.apache.catalina.session.StandardSession.expire(
> StandardSession.java:766)
>     at
> org.apache.catalina.session.StandardManager.stopInternal(
> StandardManager.java:396)
>     at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
>     at
> org.apache.catalina.core.StandardContext.stopInternal(
> StandardContext.java:5407)
>     at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
>     at
> org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:815)
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message