title: EAR application works on Websphere8.5 but refuses to work on Websphere liberty 16.0.0.4
body: <p>I get in inheritance <a href="https://en.wikipedia.org/wiki/EAR_(file_format)" rel="nofollow noreferrer">EAR application</a> which I need to continue to develop. The problem that I can't cause it work on <a href="https://developer.ibm.com/wasdev/blog/2016/12/13/new-release-websphere-liberty-16-0-0-4/" rel="nofollow noreferrer">Websphere Liberty 16.0.0.4</a> while on Websphere Application Server Full Profile 8.5 it works fine.  Unfortunately or (fortunately :) ) my working station is Macbook Pro, and WAS Full Profile can't be installed on OSX (can't find links right now, but have done some search and find enough evidences for it) so I need to use VirtualBox with Linux or try to run this app on Liberty. </p>
  
  <p>The latest solution doesn't work so well for me, I get the following error:</p>
  
  <blockquote>
    <p>[ERROR   ] CWWJP0012E: The persistence unit name is not specified and
    a unique persistence unit is not found in the BigEnterpriseAppEAR
    application and BigEnterpriseAppEJB.jar module. [ERROR   ] CWWJP0029E:
    The server cannot find the  persistence unit in the
    BigEnterpriseAppEJB.jar module and the BigEnterpriseAppEAR
    application. [ERROR   ] CWNEN0035E: The java:comp/env/BigEnterpriseApp
    reference of type javax.persistence.EntityManager for the DataProvider
    component in the BigEnterpriseAppEJB.jar module of the
    BigEnterpriseAppEAR application cannot be resolved. [ERROR   ]
    CNTR0020E: EJB threw an unexpected (non-declared) exception during
    invocation of method "getDataByOwner" on bean
    "BeanId(BigEnterpriseAppEAR#BigEnterpriseAppWEB.war#DataAPI, null)". 
    Exception data: javax.ejb.EJBTransactionRolledbackException: nested
    exception is: javax.ejb.EJBException:   The
    java:comp/env/BigEnterpriseApp reference of type
    javax.persistence.EntityManager for the DataProvider component in the
    BigEnterpriseAppEJB.jar module of the BigEnterpriseAppEAR application
    cannot be resolved.</p>
  </blockquote>
  
  <p>The app is pretty simple <code>EAR</code> = <code>JPA</code> + <code>EJB</code> + <code>WAR</code> </p>
  
  <p><strong>I don't know which configuration files would be helpful, so just write in a comments what to post and I will do it.</strong></p>
  
  <p>Thank you in advance.</p>
  
  <p>UPDATE 1:</p>
  
  <p><code>server.xml</code> file: </p>
  
  <pre><code>&lt;server description="new server"&gt;
  
      &lt;!-- Enable features --&gt;
      &lt;featureManager&gt;
          &lt;feature&gt;localConnector-1.0&lt;/feature&gt;
           &lt;feature&gt;servlet-3.1&lt;/feature&gt;
           &lt;feature&gt;ejbLite-3.1&lt;/feature&gt;
           &lt;feature&gt;jndi-1.0&lt;/feature&gt;
           &lt;feature&gt;jaxrs-1.1&lt;/feature&gt;
           &lt;feature&gt;ssl-1.0&lt;/feature&gt;
           &lt;feature&gt;jpa-2.0&lt;/feature&gt;
           &lt;feature&gt;cdi-1.0&lt;/feature&gt;
      &lt;/featureManager&gt;
  
      &lt;basicRegistry id="basic" realm="BasicRealm"&gt;
          &lt;!-- &lt;user name="yourUserName" password="" /&gt;  --&gt;
      &lt;/basicRegistry&gt;
  
      &lt;!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" --&gt;
      &lt;httpEndpoint httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint"/&gt;
  
      &lt;!-- Automatically expand WAR files and EAR files --&gt;
      &lt;applicationManager autoExpand="true"/&gt;
  
  
      &lt;applicationMonitor updateTrigger="mbean"/&gt;
  
      &lt;library id="DB2JCC4Lib"&gt;
           &lt;fileset dir="/Users/anatoly/developer/sql_drivers" includes="*.jar"/&gt;
      &lt;/library&gt;
  
      &lt;dataSource id="db2_slc" jndiName="jdbc/BEADB" type="javax.sql.DataSource"&gt;
              &lt;jdbcDriver libraryRef="DB2JCC4Lib"/&gt;
              &lt;properties.db2.jcc databaseName="beadb" password="********" portNumber="50000" serverName="db2server" user="db2username"/&gt;
      &lt;/dataSource&gt;
  
      &lt;keyStore id="defaultKeyStore" password="******"/&gt;
  
      &lt;enterpriseApplication id="BigEnterpriseAppEAR" location="BigEnterpriseAppEAR.ear" name="BigEnterpriseAppEAR"/&gt;
  &lt;/server&gt;
  </code></pre>
  
  <p><code>persistence.xml</code> file, located in <strong>BigEnterpriseAppJPA > src > META-INF > persistence.xml</strong></p>
  
  <p>in packaged EAR <code>persistence.xml</code> located in <strong>BigEnterpriseAppEAR -> BigEnterpriseAppJPA.jar -> META-INF -> persistence.xml</strong>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"&gt;
      &lt;persistence-unit name="BigEnterpriseApp"&gt;
          &lt;jta-data-source&gt;jdbc/BEADB&lt;/jta-data-source&gt;
          &lt;class&gt;com.bea.entities.System&lt;/class&gt;
          &lt;class&gt;com.bea.entities.Data&lt;/class&gt;
          &lt;class&gt;com.bea.entities.User&lt;/class&gt;
          &lt;class&gt;com.bea.entities.Group&lt;/class&gt;
          &lt;properties&gt;
              &lt;property name="openjpa.jdbc.Schema" value="BEADB" /&gt;
              &lt;property name="openjpa.ConnectionRetainMode" value="transaction" /&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>