users@glassfish.java.net

Re: Glassfish V3 - Could not resolve persistence unit....

From: <glassfish_at_javadesktop.org>
Date: Wed, 03 Feb 2010 08:10:54 PST

I have a similar issue with a project.

I have 3 ejb modules each one with a different persistence.xml in each one i define one persistence-context

ConfigurationEJB (ejb,jpa) persistence-context: config, datasource config
WorkflowEJB(ejb, jpa) persistence-context: workflow, datasource wf
AccountEJB(ejb, jpa) persistence-context: tramisalud, datasource ts

When i deploy by the command line i get this error
What happends is that every ejb on BusissnessEJB is inyected with the configurationBean that is on the ConfigurationEJB to retrieve the config from database. The error is this.

com.sun.enterprise.admin.cli.CommandException: remote failure: Exception while preparing the app : org.glassfish.deployment.common.DeploymentException: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [com.esoftla.scd.eapps.tramisalud.bean.ConfigurationManagerBean/em] in the scope of the module called [com.esoftla.scd.eapps.account#com.esoftla.scd.eapps.account.beans.jar]. Please verify your application.
Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method : java.lang.RuntimeException: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [com.esoftla.scd.eapps.tramisalud.bean.ConfigurationManagerBean/em] in the scope of the module called [com.esoftla.scd.eapps.account#com.esoftla.scd.eapps.account.beans.jar]. Please verify your application.

In the ConfigurationEJB i have the persistence context.

Reading the error i guess it said that can't find the persistence-context in the module Account where the caller is.

If i add the persistence context "config" to the persistence.xml in the AccountEJB package

com.sun.enterprise.admin.cli.CommandException: remote failure: Exception while preparing the app : org.glassfish.deployment.common.DeploymentException: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [config] in the scope of the module called [com.esoftla.scd.eapps.account#com.esoftla.scd.eapps.account.beans.jar]. Please verify your application.
Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method : java.lang.RuntimeException: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [config] in the scope of the module called [com.esoftla.scd.eapps.account#com.esoftla.scd.eapps.account.beans.jar]. Please verify your application.

Any ideas will help.
[Message sent by forum member 'neoecos' (neoecos_at_gmail.com)]

http://forums.java.net/jive/thread.jspa?messageID=384547