<font size=2 face="sans-serif">Hello Matej<br>
<br>
I spoke to the customer, who kindly provided the following source on github:
</font><a href="https://github.com/elexx/was9_bugs/tree/master/bug21"><font size=2 color=blue face="sans-serif">https://github.com/elexx/was9_bugs/tree/master/bug21</font></a>
<br>
<br><font size=2 face="sans-serif">It looks like the code is bound to a
@PreDestroy method on the @SessionScoped annotated class UserSessionData.
The PreDestroy fires because session.invalidate() is called in LogoutServlet.
</font>
<br>
<br><font size=2 face="sans-serif">Looking at </font><a href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#request_context"><font size=2 color=blue face="sans-serif">http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#request_context</font></a><font size=2 face="sans-serif">
it doesn't seem like any of the four cases when the spec applies here.
We have left LogoutServlet's service() method before the new thread calls
the preDestroy method. So I think this is an application issue. <br>
<br>
Regards<br>
Benjamin</font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Matej Novotny &lt;manovotn@redhat.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Benjamin Confino &lt;BENJAMIC@uk.ibm.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">weld-dev@lists.jboss.org</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">12/06/2018 13:17</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size=1 face="sans-serif">Re: [weld-dev]
RquestScoped not active inside &nbsp; &nbsp; &nbsp; &nbsp;WeldInitialListener.requestDestroyed</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>Hi,<br>
<br>
what does user code look like?<br>
Does he have an event listener?<br>
<br>
I'd say this depends on *precisely* what is his code bound to.<br>
At some point (after the invalidation), you should be getting ContextNotActiveException
so I guess we need to know more about the code to determine this.<br>
If the user has some code bound to &quot;generic&quot; servlet events,
it may well happen that they fire after CDI events.<br>
<br>
Matej<br>
<br>
----- Original Message -----<br>
&gt; From: &quot;Benjamin Confino&quot; &lt;BENJAMIC@uk.ibm.com&gt;<br>
&gt; To: weld-dev@lists.jboss.org<br>
&gt; Sent: Monday, June 11, 2018 10:46:31 AM<br>
&gt; Subject: [weld-dev] RquestScoped not active inside &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WeldInitialListener.requestDestroyed<br>
&gt; <br>
&gt; Hello.<br>
&gt; <br>
&gt; I have a customer who's getting ContextNotActiveExceptions for the<br>
&gt; RequestScoped Context. This happens inside the invocation of<br>
&gt; WeldInitialListener.requestDestroyed() after the customer's application<br>
&gt; invalidated the session. DefaultLifecycleCallbackInvoker.invokeMethods<br>
&gt; invokes a method in application code, which calls a method on a proxy,
which<br>
&gt; results in weld attempting to get the context from the BeanManager
and the<br>
&gt; ContextNotActiveException.<br>
&gt; <br>
&gt; My question is simple. Is this an integration issue or is this an
application<br>
&gt; issue?<br>
&gt; <br>
&gt; Here is the stack:<br>
&gt; <br>
&gt; org.jboss.weld.context.ContextNotActiveException: WELD-001303: No
active<br>
&gt; contexts for scope type javax.enterprise.context.RequestScoped<br>
&gt; at<br>
&gt; org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:731)<br>
&gt; at<br>
&gt; org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.getIfExists(ContextualInstanceStrategy.java:89)<br>
&gt; at<br>
&gt; org.jboss.weld.bean.ContextualInstanceStrategy$CachingContextualInstanceStrategy.getIfExists(ContextualInstanceStrategy.java:164)<br>
&gt; at<br>
&gt; org.jboss.weld.bean.ContextualInstance.getIfExists(ContextualInstance.java:63)<br>
&gt; at<br>
&gt; org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:83)<br>
&gt; at<br>
&gt; org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)<br>
&gt; &lt;CustomerClass&gt;$$_WeldClientProxy.getUserId(Unknown Source)<br>
&gt; <br>
&gt; &lt;Application Code&gt;<br>
&gt; <br>
&gt; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
&gt; at<br>
&gt; sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)<br>
&gt; at<br>
&gt; sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)<br>
&gt; at java.lang.reflect.Method.invoke(Method.java:508)<br>
&gt; at<br>
&gt; org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:97)<br>
&gt; at<br>
&gt; org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.preDestroy(DefaultLifecycleCallbackInvoker.java:90)<br>
&gt; at<br>
&gt; org.jboss.weld.injection.producer.BasicInjectionTarget.preDestroy(BasicInjectionTarget.java:127)<br>
&gt; at org.jboss.weld.bean.ManagedBean.destroy(ManagedBean.java:191)<br>
&gt; at<br>
&gt; org.jboss.weld.util.bean.IsolatedForwardingBean.destroy(IsolatedForwardingBean.java:50)<br>
&gt; at<br>
&gt; org.jboss.weld.context.AbstractContext.destroyContextualInstance(AbstractContext.java:139)<br>
&gt; at org.jboss.weld.context.AbstractContext.destroy(AbstractContext.java:153)<br>
&gt; at<br>
&gt; org.jboss.weld.context.AbstractManagedContext.deactivate(AbstractManagedContext.java:58)<br>
&gt; at<br>
&gt; org.jboss.weld.context.AbstractBoundContext.deactivate(AbstractBoundContext.java:72)<br>
&gt; at<br>
&gt; org.jboss.weld.servlet.HttpContextLifecycle.safelyDeactivate(HttpContextLifecycle.java:378)<br>
&gt; at<br>
&gt; org.jboss.weld.servlet.HttpContextLifecycle.requestDestroyed(HttpContextLifecycle.java:311)<br>
&gt; at<br>
&gt; org.jboss.weld.servlet.WeldInitialListener.requestDestroyed(WeldInitialListener.java:135)<br>
&gt; at<br>
&gt; com.ibm.ws.webcontainer.managedobject.ManagedObjectListenerWrapper.requestDestroyed(ManagedObjectListenerWrapper.java:98)<br>
&gt; at<br>
&gt; com.ibm.ws.webcontainer.webapp.WebApp.notifyServletRequestDestroyed(WebApp.java:2042)<br>
&gt; at<br>
&gt; com.ibm.wsspi.webcontainer.collaborator.CollaboratorHelper.postInvokeCollaborators(CollaboratorHelper.java:532)<br>
&gt; at<br>
&gt; com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1282)<br>
&gt; at<br>
&gt; com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:82)<br>
&gt; at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:963)<br>
&gt; at<br>
&gt; com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)<br>
&gt; at<br>
&gt; com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:382)<br>
&gt; at<br>
&gt; com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)<br>
&gt; at<br>
&gt; com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:532)<br>
&gt; at<br>
&gt; com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:318)<br>
&gt; at<br>
&gt; com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)<br>
&gt; at<br>
&gt; com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)<br>
&gt; at<br>
&gt; com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)<br>
&gt; at<br>
&gt; com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)<br>
&gt; at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)<br>
&gt; at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)<br>
&gt; at<br>
&gt; com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)<br>
&gt; at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)<br>
&gt; at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1909)<br>
&gt; <br>
&gt; Unless stated otherwise above:<br>
&gt; IBM United Kingdom Limited - Registered in England and Wales with
number<br>
&gt; 741598.<br>
&gt; Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6 3AU<br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; weld-dev mailing list<br>
&gt; weld-dev@lists.jboss.org<br>
&gt; </font></tt><a href="https://lists.jboss.org/mailman/listinfo/weld-dev"><tt><font size=2>https://lists.jboss.org/mailman/listinfo/weld-dev</font></tt></a><tt><font size=2><br>
<br>
</font></tt>
<br>
<br><font size=2 face="sans-serif"><br>
Unless stated otherwise above:<br>
IBM United Kingdom Limited - Registered in England and Wales with number
741598. <br>
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU<br>
</font>