[
https://issues.jboss.org/browse/WFLY-5716?page=com.atlassian.jira.plugin....
]
Ste Gr commented on WFLY-5716:
------------------------------
I've extended my test and added event observers for the request scope (initialize and
destroy). The context will be created but the bean is not affected.
*wfly5716-app*
{code}
13:32:58,206 INFO [stdout] (default task-8) [app] IFrameworkResourceManager = Proxy for
remote EJB StatelessEJBLocator for "/wfly5716-fw/WebFrameworkImpl", view is
interface testing.wfly5716.share.IWebFramework, affinity is None
13:32:58,206 INFO [stdout] (default task-8) New request: Request context initialized for
EJB invocation [class org.jboss.weld.event.ContextEvent]
13:32:58,206 INFO [stdout] (default task-8) [fw] invoke WebFrameworkImpl#resolveUser
13:32:58,206 INFO [stdout] (default task-8) [fw] testing.wfly5716.fw.RequestBean@2c5c8faf
INIT
13:32:58,206 INFO [stdout] (default task-8) [fw] testing.wfly5716.fw.RequestBean@2c5c8faf
DUMMY
13:32:58,206 INFO [stdout] (default task-8) [fw] testing.wfly5716.fw.RequestBean@2c5c8faf
DESTROY
13:32:58,206 INFO [stdout] (default task-8) End request: Request context destroyed after
EJB invocation [class org.jboss.weld.event.ContextEvent]
13:32:58,206 INFO [stdout] (default task-8) New request: Request context initialized for
EJB invocation [class org.jboss.weld.event.ContextEvent]
13:32:58,206 INFO [stdout] (default task-8) [fw] invoke WebFrameworkImpl#resolveRights
13:32:58,206 INFO [stdout] (default task-8) [fw] testing.wfly5716.fw.RequestBean@2c5c8faf
DUMMY
13:32:58,206 INFO [stdout] (default task-8) End request: Request context destroyed after
EJB invocation [class org.jboss.weld.event.ContextEvent]
{code}
Wrong handling of request context for remote EJB calls
------------------------------------------------------
Key: WFLY-5716
URL:
https://issues.jboss.org/browse/WFLY-5716
Project: WildFly
Issue Type: Bug
Components: CDI / Weld, EJB
Affects Versions: 9.0.0.Final, 10.0.0.CR4
Reporter: Ste Gr
Assignee: Stuart Douglas
Attachments: wfly5716.zip
Two applications deployed to Wildfly. The first one provides a singleton remote ejb which
uses request scoped beans (in this case a RESOURCE_LOCAL entity manager manged by a CDI
producer/disposer, but +all+ request scoped beans are affected). The second application
uses that EJB to get some data only accessible by the first application.
A request is made to the second app from a browser. The app will get the remote EJB and
invokes two methods on it. The first method produces the entity manager, accesses the
database and returns the result. The entity manager will be disposed again. The second
method won't produce a new entity manager but tries to re-use the one from the
previous invokation. This fails as the entity manager was disposed.
If the same use-case is made using the first app everythings works as desired. But it
doesn't look right (or the request context is joined because it is the same
application). It produces the the entity manager on the first invocation and closes it as
soon as the whole request made from the browser is completed. Thats why the second
invokation has a valid entity manager to work with.
I don't know the spec but:
- either the first EJB invokation from second app to first app is not allowed to dispose
the request context (all the request scoped beans)
- or each invokation must get its own request context (entity manager must be produced
and disposed again).
I've made a [stackoverflow
thread|http://stackoverflow.com/q/33826720/1741604] which
shows some code examples.
(JBoss AS 7.1.3.Final is also affected but it is not available in 'affected
version/s')
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)