Can I (and if so, how?) lookup CDI managed beans using javax.naming.Context#lookup
in EJB module?
I'm using GlassFish v3. I suppose that I can use @Named
, but what is JNDI name of CDI managed bean? I want to lookup them from unmanaged POJOs so I can't use @Inject
.
You can lookup the BeanManager
via JNDI (java:comp/BeanManager
) then use the JSR-299 API hung off of the BeanManager
to get a contextual reference to a managed bean.
JSR-299 managed beans are not available for direct JNDI lookup.