6 Replies Latest reply on Dec 28, 2012 12:50 PM by M Muthukumaran

    How to make persistence unit visible for other deployments (not EAR)

    Michal Glowacki Novice

      hi,

       

         as my process of migrating from AS 5.1 to 7 is going ahead, more problems come. As in 5.1 I had one persistence unit defined, in my entitybeans.jar deployment. Another deployments like sessionbeans.jar or war archives, just had it on the classpath and could use without problems. I think due to changed class loading now it is not possible. When I deploy sessionbeans.jar I got an error:

       

      "Can't find a deployment unit named MyPU at deployment "SessionBeans.jar"" in the line of the code where is:

       

      @PersistenceContext(unitName="MyPU") private EntityManager entityManager;

       

      My deployment dir looks like this:

       

      /..

      /EntityBeans.jar

      /SessionBeans.jar

      /WebApplication1.war

      /WebApplication2.war

       

      Is the only solution to put every deployment using persistence unit from entitybeans into one big EAR file?

       

      Regards,

      Michal