title: javax.persistence.PersistenceException: No Persistence provider for EntityManager named sample
body: <p>I am using Hibernate Entity Manager. It complains that it cant find persistence provider but still logs it in the logs :</p>
  
  <pre><code>    TRACE 2011-02-21 22:17:52,843 [main](Ejb3Configuration.java:321) org.hibernate.ejb.Ejb3Configuration - PersistenceMetadata(version=2.0) [
          name: sample
          jtaDataSource: null
          nonJtaDataSource: null
          transactionType: RESOURCE_LOCAL
          provider: org.hibernate.ejb.HibernatePeristence
          useQuotedIdentifiers: false
          classes[
          ]
          packages[
          ]
          mappingFiles[
          ]
          jarFiles[
          ]
          hbmfiles: 0
          properties[
              hibernate.connection.username: scott
              hibernate.connection.password: tiger
              hibernate.dialect: org.hibernate.dialect.OracleDialect
              hibernate.show_sql: true
              hibernate.connection.url: jdbc:oracle:thin:@localhost:1521:krsna
              hibernate.archive.autodetection: class, hbm
              hibernate.connection.driver_class: oracle.jdbc.driver.OracleDriver
          ]]
      Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named sample
          at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
          at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
          at EMPersistDemo2.main(EMPersistDemo2.java:26)
  </code></pre>
  
  <p>It is evident that it finds it, logs it ...but still throws that exception.
  Am I missing some thing ?</p>
  
  <p>I am using maven and I placed persistence.xml in src/main/resources/META-INF.
  Its contents are :</p>
  
  <pre><code>    &lt;!-- persistence.xml --&gt;
      &lt;persistence ...&gt;
         &lt;persistence-unit name="sample"&gt;
          &lt;provider&gt;org.hibernate.ejb.HibernatePeristence&lt;/provider&gt;
          &lt;!-- Scan for annotated classes and Hibernate mapping XML files --&gt;
          &lt;properties&gt;
             &lt;property name="hibernate.archive.autodetection" value="class, hbm"/&gt;
             &lt;property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/&gt;
             &lt;property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:krsna"/&gt;
             &lt;property name="hibernate.connection.username" value="scott"/&gt;
             &lt;property name="hibernate.connection.password" value="tiger"/&gt;
             &lt;property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/&gt;
             &lt;property name="hibernate.show_sql" value="true"/&gt;
          &lt;/properties&gt;
          &lt;/persistence-unit&gt;
  
      &lt;/persistence&gt;
  </code></pre>
  
  <p>org.hibernate.Ejb3Configuration is able to find it javax.persitence.Persistence is not able to find it:</p>
  
  <pre><code>EntityManagerFactory emf = Persistence.createEntityManagerFactory("sample");
  </code></pre>