users@glassfish.java.net

Re: one persistence unit for few EJB modules in one EAR

From: Sahoo <sahoo_at_sun.com>
Date: Mon, 19 Jan 2009 22:38:08 +0530

Put your entity.jar containing persistence.xml in ear/lib directory.

Witold Szczerba wrote:
> Hi there,
> can you, please, tell me how should I package my EAR file with one,
> two or more EJB modules in a way that every EJB module could share one
> persistence unit? I was trying different things, so please spare me
> describing what I tried and did not work. Right now all I can get is
> to put persistence.xml file inside one of EJB module. But that module
> is the only one where I can inject EntityManager.
> As soon as I move persistence.xml from within EJB-JAR somewhere else,
> I cannot deploy EAR, because session beans of that EJB-EAR cannot find
> persistence unit anymore.
>
> This is what I get when deploying:
>
> Exception occured in J2EEC Phase
> com.sun.enterprise.deployment.backend.IASDeploymentException: Could
> not resolve a persistence unit corresponding to the
> persistence-context-ref-name
> [pl.ibpolsoft.netbroker.core.services.DummyEJBBean/em] in the scope of
> the module called
> [gfdeploy#/home/witoldsz/NetBeansProjects/netBroker/netBroker-ear/dist/gfdeploy/netBroker-ejb_jar].
> Please verify your application.
>
> The bottom line is I would like to be able to make my application
> (EAR) of several EJB modules, so they would be able to communicate
> using local interfaces and share one persistence unit. Can you tell me
> how exactly should my EAR and EJBs look like?
>
> Thanks,
> Witold Szczerba
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>