users@glassfish.java.net

Re: CDI Instances and EJB and Glassfish

From: <glassfish_at_javadesktop.org>
Date: Tue, 20 Jul 2010 11:33:48 PDT

Hi, Marina; I was just about to post. I figured out the root of the problem. The resource adapter did not have a corresponding connector connection pool defined. The stack did not indicate this at all, but I was lucky that I remembered a forum post from about a month ago that mentioned that if you saw this obscure pile of error messages that's what it meant. :-) I defined the pool, the resource adapter initialized OK, and dependency injection worked.

One round trip later, and NOW what's blowing up is my persistence unit injection. (I am rapidly coming to the conclusion that DI in general is a royal pain in the neck--it is single handedly responsible for obscuring most of my errors and costing me most of my wasted time.)

Specifically, my SLSB that has a @PersistenceContext private EntityManager em field is constructing just fine, being installed just fine, and then...the em field is null. There is no error, no JNDI problem, no nothing--it's just null. At least I'm out of the CDI and resource adapter woods!

Best,
Laird
[Message sent by forum member 'ljnelson']

http://forums.java.net/jive/thread.jspa?messageID=478118