users@glassfish.java.net

Error resolving persistence context

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Thu, 20 Dec 2012 11:24:38 -0800

If I have a META-INF/persistence.xml with a persistence unit defined within
it named "cx", and if in an EJB module somewhere I have this:

@PersistenceContext(name = "cx")

...and there are no XML deployment descriptors doing any kind of
overriding, and I'm still getting the following error:

Could not resolve a persistence unit corresponding to the
persistence-context-ref-name [cx] in the scope of the module...

...what does that mean? What else should I be verifying?

This is with embedded GlassFish version 3.1.1. I have logging on
javax.enterprise, com.sun.enterprise and org.glassfish dialed up to FINEST.
 The amount of verbiage is truly stunning, but no log output indicates what
is wrong. I do see the low-level XML parsing routines successfully parsing
my persistence.xml and finding the persistence unit named "cx", so at least
at that point it is known to the system.

Is there some way to get embedded GlassFish to output a server.log that
would contain something besides what is barfed to the screen? Is there
some way to get embedded GlassFish to leave its temporary directory behind?
 Maybe there's something wrong with the EJB module itself?

Thanks,
Laird

-- 
http://about.me/lairdnelson