users@glassfish.java.net

Re: persistence-unit-ref issue

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Wed, 14 Mar 2007 23:31:37 +0530

Unless the ejb-jar is packaged in WEB-INF/lib folder of the war file,
the persistence unit packaged in that ejb-jar won't be visible to the
war as per standard visibility rules of persistence units, described in
section *#6.2.2* of the JPA spec. Please create a separate *library* jar
file and put the persistence.xml inside it so that it can be visible to
both the ejb-jar as well as the war. Check [1] for an example of such
packaging.

Thanks,
Sahoo

[1]
http://weblogs.java.net/blog/ss141213/archive/2005/12/using_java_pers.html
glassfish_at_javadesktop.org wrote:
> Hey,
>
> i created a project with Netbeans that includes EJB/WEB modules,
>
> I tried to add in web-xml a persistence-unit-ref as follows:
>
> <persistence-unit-ref>
> <persistence-unit-ref-name>acc_em</persistence-unit-ref-name>
> <persistence-unit-name>pu1</persistence-unit-name>
> </persistence-unit-ref>
>
>
> In deployment time, I get:
>
> Could not resolve a persistence unit corresponding to the persistence-unit-ref-name [acc_em] in scope of the module called []. Please verify your application,
>
>
> Why is that? I have a persistenence.xml file included in my EJBs module.
>
> I guess the web app cant access the persistence unit named 'pu1' for some reason,
>
>
> (note: in netbeans i have added the 'ejb-module' as a library my the web-module)
>
> thanks.
> [Message sent by forum member 'demiant' (demiant)]
>
> http://forums.java.net/jive/thread.jspa?messageID=207860
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>