title: No Persistence provider for EntityManager named test
body: <p>I'm trying to develop a Java EE web application using JPA to manage the DB. </p>
  
  <p>When I try to retrieve the rows from my database I've an error : </p>
  
  <blockquote>
    <p>"No Persistence provider for EntityManager named test"</p>
  </blockquote>
  
  <p>The code of my function using JPA is  : </p>
  
  <pre><code>EntityManagerFactory emf = Persistence.createEntityManagerFactory("test");      
       EntityManager em =emf.createEntityManager();        
       EntityTransaction tx = em.getTransaction();
       try {
           tx.begin();
            @SuppressWarnings("unchecked")
            List&lt;InputHStock&gt; iph = em.createQuery("from Student").getResultList();
            for (Iterator&lt;InputHStock&gt; iterator = iph.iterator(); iterator.hasNext();) {
              InputHStock student = (InputHStock) iterator.next();
              System.out.println(student.getLocationCode());
            }
            tx.commit();
          } catch (Exception e) {
            tx.rollback();
          }   
  }
  </code></pre>
  
  <p>My persistence.xml file : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.1" 
  xmlns="http://xmlns.jcp.org/xml/ns/persistence" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence 
   http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"&gt;
      &lt;persistence-unit name="test"&gt;
      &lt;class&gt;application.InputHStock&lt;/class&gt;
       &lt;properties&gt;
        &lt;property name="javax.persistence.jdbc.driver"     value="oracle.jdbc.driver.OracleDriver" /&gt;
        &lt;property name="javax.persistence.jdbc.url"    value="jdbc:oracle:thin:@localhost:1521:xe" /&gt;
        &lt;property name="javax.persistence.jdbc.user" value="testSQL" /&gt;
        &lt;property name="javax.persistence.jdbc.password" value="testpwd1" /&gt;
        &lt;property name="eclipselink.ddl-generation" value="create-tables" /&gt;
        &lt;property name="eclipselink.ddl-generation.output-mode" value="database" /&gt;
        &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>Here is my arborescence in eclipse  : </p>
  
  <p><a href="https://i.stack.imgur.com/5RHU1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5RHU1.png" alt="enter image description here"></a></p>
  
  <p>I've also tried using the Eclipse tool to include JPA but without success. </p>
  
  <p>Note that the connection to the database is working as I can retrieve my data when using directly JDBC.</p>