title: Unable to lookup JNDI name
body: <p>hi i'm using netbeans+glassfish
  i'm trying to run this code:
  i only create DB without any table ( by running this code i want to create tables and persist my object)</p>
  
  <pre><code>public static void main(String[] args) {
      SmartphoneService ss = new SmartphoneService();
      Smartphone smart = new Smartphone(0, 0, null, null, null);
      ss.create(smart);
  }
  </code></pre>
  
  <p>but i got this error :</p>
  
  <pre><code>Unable to lookup JNDI name
  </code></pre>
  
  <p>my persistence.xml:</p>
  
  <pre><code> &lt;persistence-unit name="manager1" transaction-type="RESOURCE_LOCAL"&gt;
  &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
  &lt;jta-data-source&gt;java:comp/env/jdbc/mysql&lt;/jta-data-source&gt;
  &lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt;
  &lt;properties&gt;
    &lt;property name="javax.persistence.schema-generation.database.action" value="create"/&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>my class smartphoneservice:</p>
  
  <pre><code>@Stateless
  public class SmartphoneService implements IDao&lt;Smartphone&gt;  {
  
  private static final String JPQL_SELECT_PAR_ID = "SELECT u FROM Smartphone u WHERE u.idSmartphone=:id";
  
  private EntityManagerFactory emf;
  
  private EntityManager em;
  
  public SmartphoneService() {
      emf = Persistence.createEntityManagerFactory("manager1");
      em = emf.createEntityManager();
  }
  public boolean create( Smartphone smart) {
      try {
          em.getTransaction().begin();
          em.persist(smart);
          em.getTransaction().commit();
          return true;
  
      } catch (Exception e) {
          if (em.getTransaction() != null) {
              em.getTransaction().rollback();
          }
      } finally {
          em.close();
          emf.close();
      }
      return false;
  }}
  </code></pre>
  
  <p>i checked my connection pool ping ( Ping Succeeded )</p>
  
  <p>thanks for ur help</p>