users@glassfish.java.net

Re: EntityManager not being injected into abstract EJB?

From: <glassfish_at_javadesktop.org>
Date: Wed, 14 Apr 2010 10:47:20 PDT

Continuing down this lovely road....

I've laboriously removed all dependence on my abstract DAO class, and injection is still not occurring. So class hierarchy has nothing to do with it.

The odd thing is that if I duplicate this same setup but inside a single classpath root everything seems to work fine.

That is, I wouldn't even be in this position unless my long-fought and hard-won battle over the forces of Glassfish embedded had been won.

During that battle, I set up a repeatable unit test that creates a new EJBContainer, then looks up a particular bean out of it, and makes it available for testing. As part of the unit tests for [i]that[/i], I created some dummy entities, and a persistence.xml, and a dummy EJB that uses an EntityManager. I verify that that works fine.

There is no difference between that EJB and the one I now have, except that the dummy entities were also in the dummy EJB's classpath root.

So again: everything works fine when com.foo.Entity and com.foo.DAOUnderTest are located under the same test-classes directory tree. But everything doesn't work fine, it appears, when com.foo.DAOUnderTest is found in test-classes and com.foo.some.other.package.Entity is found in someJarFile.jar.

I realize I'm talking to myself but if there is anyone else out there who has seen anything like this I'd really appreciate any information they have.

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

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