title: What is the cause of error "No META-INF/persistence.xml was found in classpath"?
body: <p>Included all necesaary toplinks lib still getting following error on running example.java</p>
  
  <p>using netbeans 6.8</p>
  
  <p>No META-INF/persistence.xml was found in classpath.</p>
  
  <p>Persistence.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="1.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_1_0.xsd"&gt;
    &lt;persistence-unit name="MatdaanPU" transaction-type="JTA"&gt;
      &lt;provider&gt;oracle.toplink.essentials.PersistenceProvider&lt;/provider&gt;
      &lt;jta-data-source&gt;matdaan&lt;/jta-data-source&gt;
      &lt;class&gt;EntityBeans.Trial&lt;/class&gt;
      &lt;exclude-unlisted-classes&gt;true&lt;/exclude-unlisted-classes&gt;
      &lt;properties&gt;
        &lt;property name="toplink.ddl-generation" value="create-tables"/&gt;
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <hr>
  
  <p>Example.java</p>
  
  <pre><code>import java.util.List;
  import javax.persistence.EntityManager;
  import javax.persistence.EntityManagerFactory;
  import javax.persistence.Persistence;
  public class Example {
      public Example() {
  
          EntityManagerFactory emf=Persistence.createEntityManagerFactory("MatdaanPU");
          EntityManager em=emf.createEntityManager();
         List results = em.createNamedQuery("Trial.findById")
      .setParameter("id", "1")
      .getResultList();
         System.out.println("HI");
          System.out.println(results.get(1));
      }
  
      public static void main(String args[]){
          Example e=new Example();
  
      }
  }
  </code></pre>
  
  <hr>
  
  <p>Directory structure</p>
  
  <pre><code>Root
  |
  |
  |----src
  |     |
  |     |----conf
  |          |
  |          |-----Manifest.MF
  |          |-----Persistence.xml   
  </code></pre>