[cdi-dev] CDI.current() vs initialContext.lookup("java:comp/BeanManager") in modular application servers
arjan.tijms at gmail.com
Thu Apr 28 08:15:53 EDT 2016
I noticed a difference between using CDI.current()
and initialContext.lookup("java:comp/BeanManager") when called from within
a container jar (e.g. Mojarra) in a modular application server (e.g.
With CDI.current() the bean manager I get when called from within Mojarra
"Weld BeanManager for com.sun.jsf-impl:main.additionalClasses [bean
With initialContext.lookup("java:comp/BeanManager") it's:
Weld BeanManager for example_app.ear/example_app.war/WEB-INF/classes [bean
Where "example_app" is an EAR application that I used for testing.
I wonder, is this difference intended and did I overlook something, or is
it an unfortunate consequence of something? An additional problem is that
not all (modular) application servers act the same here. E.g. in
GlassFish/Payara I get the application bean manager in both cases.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cdi-dev