1 Reply Latest reply on Jan 19, 2012 8:52 AM by smarlow

    Deploy 2 different web applications containing same persistence unit

    sathwik.bp

      Hi,

      We have 2 web applications

      1) axis2-services.war

      2) ui-webapp.war

       

      Both these applciations use one common utility  jar which needs OpenJPA 2.1.0

       

      Under axis2 we have a service which has the common utilty jar under it's  lib directory as shown below

      axis2-services/services/myService.aar/lib/commonUtility.jar

       

      ui-webapp/WEB-INF/lib/commonUtility.jar

       

      I have configured Jboss specific property, the provider module in the persistence.xml of commonUtility.jar

       

      The openjpa module is configured under JB7.1-Final-Snapshot/modules/org/apache/openjpa/main

       

      Problem is when I deploy only axis2 I get the error

      Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named org.xxx

       

      But when I deploy ui-webapp along side axis2-services, I see that the deployment is successful without any errors.

       

      From the startup logs I see that the persistence unit service is started for ui-webapp, but there is no entry for starting the persistence unit service for the axis2.

      13:00:22,894 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) Starting deployment of "ui-webapp.war"

      13:00:22,894 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "axis2-services.war"

       

      13:00:25,374 INFO  [org.jboss.jpa] (MSC service thread 1-1) JBAS011401: Read persistence.xml for org.xxx

      13:00:26,005 INFO  [org.jboss.jpa] (MSC service thread 1-7) JBAS011402: Starting Persistence Unit Service 'ui-webapp.war#org.xxx'

       

      As per the spec 6.2.2 Persistence Unit Scope

      A persistence unit that is defined at the level of an EJB-JAR, WAR, or application client jar is scoped to that EJB-JAR, WAR, or application jar respectively and is visible to the components defined in that jar or war.

       

      Can anyone help me in this.

       

      regards,

      sathwik