4 Replies Latest reply on Dec 18, 2008 12:05 PM by ubersoldat

    Failed to find persistence unit


      I'm currently migrating a working JBoss 4.0.5.GA EAR to 5.0.0.GA. The ear is structured as this:

       |- Servlet WAR
       |- Utility JAR
       |- MDB (jms)
       |- EJB_3 (stateless/no entities, no persistence)
       |- EJB_1 (stateless/entities)
       |- EJB_2 (stateless/entities)

      Each of the EJB3 with entities have their own persistence.xml

      The EJB_3 with no entities, uses the EJB_1 and EJB_2 by Local interfaces.

      When I deploy on JBoss 5, a "failed to resolve persistence unit 1PU" error is thrown. No for 2PU, only for 1PU.

      So, I copy the 1PU persistence.xml file into the troublesome bean EJB_3 and deployments goes fine. But now, I get "Cannot open connection" errors.

      Each of this beans are independent of each other.

      The workflow is something like

      Any help? Thanks

        • 1. Re: Failed to find persistence unit

          I still don't know why EJB_3 must know anything about the persistence units that don't belong to it.

          Anyway, I fixed this by adding a persistence.xml file to the ear. I get a "resource already registered" error at deployment, but things work fine.

          • 2. Re: Failed to find persistence unit

            This is getting annoying.

            Why does JBoss follows an alphabetic order when doing the deployment?

            Shouldn't it follow the order given in "application.xml"? Now another bean called BeanB which depends on BeanK isn't being deployed.


            • 3. Re: Failed to find persistence unit

              BTW, BeanB calls BeanK, which has the PU_K. That's why it isn't being deployed. BeanB (for some reason) wants the PU_K registered, but until BeanK isn't deployed, the PU_K won't be accessible.

              This is very frustrating. Three days to migrate from Jboss 4 to 5.

              • 4. Re: Failed to find persistence unit

                Hell, I just repeat the Persistence Unit declaration in every JAR and things start working... well, I get a zillion (PU_K is alredy registered), but it works.