users@glassfish.java.net

Re: How to use PersistenceContext inside of Jersey Resource inside of GlassFish v2?

From: Sahoo <sahoo_at_sun.com>
Date: Wed, 02 Jul 2008 17:17:09 +0530

Markus,

In case of .war file, persistence.xml should be either in
WEB-INF/classes/META-INF or in META-INF dir of any of the jar files in
WEB-INF/lib dir. See section #6.2 of the JPA 1.0 spec. I guess you are
seeing the issue because you included persistence.xml in META-INF dir of
the .war file.

Thanks,
Sahoo

Markus Karg wrote:
> Sorry for cross-posting, but I do not know what is the better mailing
> list for this issue.
>
> I have written a Jersey Resource that is using JPA to access a database.
> It works pretty well when running it as a standalone
> micro-HTTP-container.
>
> Now I have migrated my solution to be a .war file running inside of
> GlassFish v2. For that, I added jersey 0.8 JARs in the /lib subfolder of
> my .war file. Jersey itself and my resource are both working well inside
> of GlassFish v2 now -- but not the JPA access.
>
> When I run verifier.bat, it tells me that there is no persistence unit
> found! But in the .war in META-INF there is a persistence.xml file, and
> it is a correct one as you can see in the attachment (we use the same
> file in another EAR and it works well there).
>
> Test Name : tests.web.PUMatchingEMandEMFRefTest
> Test Assertion : For every entity manager referenced in the application,
> there must be a matching persistence unit defined using META-INF/per
> sistence.xml file. Please refer to EJB 3.0 Persistence API Specification
> section #6.2 for further information.
> Test Description : For [ QUIPSY ]
> There is no unique persistence unit found by name [ QUIPSY ] in the
> scope of this component.
> Persistence units that are visible to this component are [ ].
>
> What is my fault and how to fix that?
>
> Thanks
> Markus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net