users@glassfish.java.net

Multiple Deployments required for persistence failure

From: <glassfish_at_javadesktop.org>
Date: Tue, 05 Jun 2007 12:24:39 PDT

I have a Web Service with a Persistnce Unit defined. When I deploy, sometimes I get the following error...

[i]Deployment Error -- Could not resolve a persistence unit corresponding to the persistence-context-ref-name [persistence/LogicalName] in the scope of the module called [C:\work\MFE\Battle Command Integrated Services\build\web]. Please verify your application. at com.sun.enterprise.deployment.BundleDescriptor.findReferencedPUsViaPCRefs(BundleDescriptor.java:689) at com.sun.enterprise.deployment.WebBundleDescriptor.findReferencedPUs(WebBundleDescriptor.java:709) at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.getAllPersistenceUnitDescriptors(PersistenceProcessor.java:158) at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processApplication(PersistenceProcessor.java:119) at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processApplication(DeploymentEventListenerImpl.java:198) at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processEvent(DeploymentEventListenerImpl.java:159) at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.notifyDeploymentEvent(DeploymentEventListenerImpl.java:109) at com.sun.enterprise.deployment.backend.DeploymentEventManager.notifyDeploymentEvent(DeploymentEventManager.java:66) at com.sun.enterprise.deployment.backend.ModuleDeployer.handlePostDeployEvent(ModuleDeployer.java:623) at com.sun.enterprise.deployment.backend.ModuleDeployer.postDeploy(ModuleDeployer.java:612) at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:175) at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:174) at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95) at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:892) at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266) at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:761) at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174) at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)[/i]

But if I keep attempting to redeploy, after 2-3 tries it works fine. My persistence.xml looks like the following...

<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  <persistence-unit name="BattleCommandIntegratedServicesPU" transaction-type="JTA">
    [i]<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
    <jta-data-source>jdbc/bcis</jta-data-source>
        <jar-file>lib/BCIS_Common.jar</jar-file>
        <jar-file>lib/Imagery_Service.jar</jar-file>
        <class>com.ngc.mfe.common.Position</class>
        <class>com.ngc.mfe.image.BaseEntryMetadata</class>
        <class>com.ngc.mfe.image.EntryMetadata</class>
        <class>com.ngc.mfe.image.ExtendedURI</class>
    <properties>
      <property name="toplink.ddl-generation" value="create-tables"/>
    </properties>
  </persistence-unit>
</persistence>[/i]

Its a weird problem because redeploying the web service appears to fix the problem. Any ideas? I am using Glassfish build 41d-beta2 and Java 1.6 with Netbeans 6 Milestone 9 as my IDE.
[Message sent by forum member 'jzacker' (jzacker)]

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