title: Use PersistenceUnit of standalone deployed jar
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4073635/sharing-a-persistence-unit-across-components-in-a-ear-file">Sharing a persistence unit across components in a .ear file</a>  </p>
  </blockquote>
  
  
  
  <p>I have a project with JPA entities and a persistence.xml file. I packaged them into a jar file and deployed to an app server (JBoss 7.1).</p>
  
  <p>I have another project, a web application, which has a session bean and I'd like to use this persistence unit there (by injection).</p>
  
  <p>However I get an exception:</p>
  
  <pre><code>Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011047: Component class com.mypackage.MyService for component MyService has errors: 
  JBAS011440: Can't find a persistence unit named my_pu in deployment "mywebapp.war"
  </code></pre>
  
  <p>I tried to add the jar of the PU as dependency in the manifest.mf of the war but without any success.</p>
  
  <p>Do you know how to achieve this?</p>