users@glassfish.java.net

Re: EntityManager not being injected into abstract EJB?

From: <glassfish_at_javadesktop.org>
Date: Thu, 15 Apr 2010 09:01:56 PDT

Ha! Got it to work. (Missed that I had to have Maven filtering on for one file.)

For anyone still awake:

When testing your EJB under Glassfish embedded, if your EJB has a @PersistenceContext, and if your test classpath defines a persistence unit by way of having a META-INF/persistence.xml...

...THEN your EJB module (defined by the classpath root your EJB happens to be found in) MUST ALSO CONTAIN all of the classes in the persistence unit.

In Maven land, this means, among other things, that you have to get very very very very creative with the use of maven-dependency-plugin:unpack-dependencies if your entities are stored in other jars.

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

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