Hi!
I work on an integration test to show if a CDI context is active on TomEE,
but there is something strange.
On the first call to BeanManager.getContext(RequestScoped.class) I get a
ContextNotActiveException.
I think it is good, because I am out of request in a background thread.
On the second call immediatelly after the first from the same thread I get
an active request context. According to this code from
org.apache.webbeans.web.context.WebContextsService during the first call a
request context is initialized, but not returned.
public ServletRequestContext getRequestContext(boolean create)
{
ServletRequestContext requestContext = requestContexts.get();
if (requestContext == null && create)
{
initRequestContext(null);
}
return requestContext;
}
I am not sure what is the intended behaviour.
Thanks in advance,
Kimmel Tamás