title: ear deployment fails - Cannot resolve reference Remote ejb-ref
body: <p>I have the following <strong>EAR</strong>:</p>
  <pre><code>dao.jar                  EJB-JAR    (has a dependency on entities.jar)
  web.war                  JSF-WAR    (hello world jsf demo - no un-jsf dependencies)
  /lib/entities.jar        POJO-JAR   (contains persistence.xml &amp; entity classes)         
         
  
          
          
  </code></pre>
  <p>I'm deploying it on <strong>Glassfish 3.1.2</strong></p>
  <p>When I attempt to package both in the EAR simultaneously I get the following <strong>deployment error</strong>:</p>
  <pre><code>     SEVERE: Exception while deploying the app [web-league-table-ear] : 
          Cannot resolve reference Remote ejb-ref 
          name=org.eclipse.persistence.jpa.rs.Service/persistenceFactory,
          Remote 3.x interface =org.eclipse.persistence.jpa.rs.PersistenceFactory,
      ejb-link=null,lookup=,mappedName=,jndi-name=,refType=Session 
      because there are 2 ejbs in the application with interface org.eclipse.persistence.jpa.rs.PersistenceFactory. 
          
      Some of the possible causes: 
          
          1. The EJB bean class was packaged in an ear lib library (or through any other 
          library mechanism which makes the library visible to all component modules), 
          this makes all the component modules include this bean class indirectly. 
              
          2. The EJB bean class was packaged in a component module which references the
           EJB, either directly or indirectly through Manifest, WEB-INF/lib. 
          
          The EJB bean class should only be packaged in the declaring ejb module and 
  not the referencing modules. The referencing modules should only 
  include EJB interfaces.
  </code></pre>
  <p>The EAR deploys correctly when:</p>
  <blockquote>
  <p>Either the dao jar <strong>or</strong> the war are ommitted.</p>
  </blockquote>
  <p>i.e.</p>
  <blockquote>
  <p>If I remove the war the EAR deploys and the Tester WebServices in the DAO work fine.</p>
  <p>If I remove the dao jar the EAR deploys and the JSF Hello World launches/works fine.</p>
  </blockquote>
  <p>Anyone any ideas?
  Thanks for reading.</p>