But wait! There's more!
So I have verified that my Instance<DAO> is non-null, and that treating it as an Iterable<DAO> will indeed return non-null instances of DAO.
But when I invoke a method on one of those things--which are, of course, proxies, since they're created by the CDI infrastructure--the just-in-time stateless session bean creation fails, claiming that a JNDI lookup (over which I have exerted no control) fails.
So:
SessionScoped war class injects...
...an Instance<DAO> which among other things contains...
...a Sessions implementation which happens to be a...
...stateless EJB that in turn has a @Resource injected into it...
...whose field is declared thusly: @Resource private KnowledgeBase kb;
When the method on the CDI proxy is invoked, obviously Weld tries to create the stateless EJB (the Sessions implementation, which it finds correctly). At that point, Glassfish tries to inject something into its kb field, and this, of course, results in JNDI trying to find "com.foobar.SessionsBean/kb" in the JNDI tree. For whatever reason, this fails with a deep NamingException.
Gaah!
Best,
Laird
[Message sent by forum member 'ljnelson']
http://forums.java.net/jive/thread.jspa?messageID=478013