3 Replies Latest reply on Jan 11, 2015 11:43 PM by busitech

    Multiple persistence units

    marvinsouza

      I have my project in the following structure:

      -- jboss-ear

      --- jboss-ejb1

      ---- META-INF

      ----- persistence.xml (jboss-pu1)

      --- jboss-ejb2

      ---- META-INF

      ----- persistence.xml (jboss-pu2)

       

      In both modules (jboss-ejb1 and jboss-ejb2), I have SessionBeans with a field 'EntityManager em' annotated with Question regarding application of @PersistenceContext (CMP) ponting to the respectives persistence-units, configured with 'unitName' property of PersistenceContext annotation.

      When I deploy the jboss-ear.jar, in WildFly CR1, the following error appears:

      16:52:04,213 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) JBAS014613: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => [
          "jboss.naming.context.java.comp.\"jboss-ear-1.0-SNAPSHOT\".\"jboss-ejb2-1.0-SNAPSHOT\".MyAnotherServiceBean.InstanceName is missing [jboss.naming.context.java.comp.\"jboss-ear-1.0-SNAPSHOT\".\"jboss-ejb2-1.0-SNAPSHOT\".MyAnotherServiceBean]",
          "jboss.deployment.subunit.\"jboss-ear-1.0-SNAPSHOT.ear\".\"jboss-ejb2-1.0-SNAPSHOT.jar\".weld.weldClassIntrospector is missing [jboss.deployment.subunit.\"jboss-ear-1.0-SNAPSHOT.ear\".\"jboss-ejb2-1.0-SNAPSHOT.jar\".beanmanager]",
          "jboss.naming.context.java.comp.\"jboss-ear-1.0-SNAPSHOT\".\"jboss-ejb2-1.0-SNAPSHOT\".MyAnotherServiceBean.ORB is missing [jboss.naming.context.java.comp.\"jboss-ear-1.0-SNAPSHOT\".\"jboss-ejb2-1.0-SNAPSHOT\".MyAnotherServiceBean]",
          "jboss.naming.context.java.comp.\"jboss-ear-1.0-SNAPSHOT\".\"jboss-ejb2-1.0-SNAPSHOT\".MyAnotherServiceBean.ValidatorFactory is missing [jboss.naming.context.java.comp.\"jboss-ear-1.0-SNAPSHOT\".\"jboss-ejb2-1.0-SNAPSHOT\".MyAnotherServiceBean]",
          "jboss.deployment.unit.\"jboss-ear-1.0-SNAPSHOT.ear\".WeldStartService is missing [jboss.persistenceunit.\"jboss-ear-1.0-SNAPSHOT.ear/jboss-ejb2-1.0-SNAPSHOT.jar#jboss-pu2\"]",
          "jboss.naming.context.java.comp.\"jboss-ear-1.0-SNAPSHOT\".\"jboss-ejb2-1.0-SNAPSHOT\".MyAnotherServiceBean.InAppClientContainer is missing [jboss.naming.context.java.comp.\"jboss-ear-1.0-SNAPSHOT\".\"jboss-ejb2-1.0-SNAPSHOT\".MyAnotherServiceBean]",
          "jboss.deployment.unit.\"jboss-ear-1.0-SNAPSHOT.ear\".deploymentCompleteService is missing [jboss.deployment.subunit.\"jboss-ear-1.0-SNAPSHOT.ear\".\"jboss-ejb2-1.0-SNAPSHOT.jar\".deploymentCompleteService]",
          "jboss.naming.context.java.comp.\"jboss-ear-1.0-SNAPSHOT\".\"jboss-ejb2-1.0-SNAPSHOT\".MyAnotherServiceBean.Validator is missing [jboss.naming.context.java.comp.\"jboss-ear-1.0-SNAPSHOT\".\"jboss-ejb2-1.0-SNAPSHOT\".MyAnotherServiceBean]",
          "jboss.deployment.subunit.\"jboss-ear-1.0-SNAPSHOT.ear\".\"jboss-ejb1-1.0-SNAPSHOT.jar\".component.MyServiceBean.START is missing [jboss.persistenceunit.\"jboss-ear-1.0-SNAPSHOT.ear/jboss-ejb2-1.0-SNAPSHOT.jar#jboss-pu2\"]",
          "jboss.naming.context.java.comp.\"jboss-ear-1.0-SNAPSHOT\".\"jboss-ejb2-1.0-SNAPSHOT\".MyAnotherServiceBean.HandleDelegate is missing [jboss.naming.context.java.comp.\"jboss-ear-1.0-SNAPSHOT\".\"jboss-ejb2-1.0-SNAPSHOT\".MyAnotherServiceBean]"
      ]}
      

       

      It seems to me that the container wants to create the beans of the second module (jboss-ejb2) without initialize the second persistence unit, on which it depends.

      If I don't package the second persistence-unit, the application is normally deployed, although I don't had examinated if the some persistence unit was injected.

       

      Where is the problem? I cannot to have 2 ejb-modules inside a ear file?

        • 1. Re: Multiple persistence units
          ctomc

          can you post full boot log (as attachment if possible)

          • 2. Re: Multiple persistence units
            marvinsouza

            Today, the application is being deployed with no problems or errors in the log.

            Things that I changed: yesterday the db2 driver was deployed as a jar and today I decided to install it as a module (with module.xml, etc) and configured the datasource with this module. After that, I restarted the jboss and did the deploy of the .ear again. All works fine.

            I think that something weird was occurring between the configuration of the first persistence unit and the second one. Maybe the database driver was being undeployed in the middle of this process.

            Well, thanks for the help, anyway.

            • 3. Re: Multiple persistence units
              busitech

              Hi Marcos, you have described exactly what I'm seeing in Wildly 8.2.0.Final, except that adding db2 as a module didn't help in my case.  My first EJB finishes verifying that all the tables exist, updates the schema, and the second EJB proceeds to crash with the very same log errors as you posted...