Skip to main content

Error resolving persistence context

2 replies [Last post]
ljnelson
Offline
Joined: 2003-08-04
Points: 0

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

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mvatkina
Offline
Joined: 2005-04-04
Points: 0

Laird,

If you are using EJBContainer API, add this JVP prop to your java
command: org.glassfish.ejb.embedded.keep-temporary-files=true and the
files created by the EJB container will be left behind.

In the latest GF this property is propagated to the GF runtime as well.

-marina
On 12/20/12 11:24 AM, Laird Nelson wrote:
> 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.logthat
> 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

mvatkina
Offline
Joined: 2005-04-04
Points: 0

Fixed a typo in my reply...

On 12/20/12 12:00 PM, Marina Vatkina wrote:
> Laird,
>
> If you are using EJBContainer API, add this JVM property to your java
> command: org.glassfish.ejb.embedded.keep-temporary-files=true and the
> files created by the EJB container will be left behind.
>
> In the latest GF this property is propagated to the GF runtime as well.
>
> -marina
> On 12/20/12 11:24 AM, Laird Nelson wrote:
>> 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.logthat 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
>