title: No Persistence provider for EntityManager named (Hibernate)
body: <p>I'm trying to run a sample JPA based project. I get the error from the title all the time.</p>
  
  <p>I looked here:
  <a href="https://stackoverflow.com/questions/1158159/no-persistence-provider-for-entitymanager-named">No Persistence provider for EntityManager named</a></p>
  
  <p>but found no working solution there.</p>
  
  <p>Here is my pom.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;~path.example&lt;/groupId&gt;
      &lt;artifactId&gt;example&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;5.1.6&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;ejb3-persistence&lt;/artifactId&gt;
              &lt;version&gt;3.3.2.Beta1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;4.3.9.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.eclipse.jst.server.generic&lt;/groupId&gt;
              &lt;artifactId&gt;oc4j&lt;/artifactId&gt;
              &lt;version&gt;1.5.105-v200709061325&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;4.0.1.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
              &lt;version&gt;4.2.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.common&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-commons-annotations&lt;/artifactId&gt;
              &lt;version&gt;4.0.1.Final&lt;/version&gt;
              &lt;classifier&gt;tests&lt;/classifier&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-jpa-2.0-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.1.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.0.GA&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;1.6.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.logging&lt;/groupId&gt;
              &lt;artifactId&gt;jboss-logging&lt;/artifactId&gt;
              &lt;version&gt;3.1.0.CR2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
              &lt;version&gt;1.6.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.spec&lt;/groupId&gt;
              &lt;artifactId&gt;jboss-javaee-6.0&lt;/artifactId&gt;
              &lt;version&gt;1.0.0.Final&lt;/version&gt;
              &lt;type&gt;provided&lt;/type&gt;
              &lt;scope&gt;pom&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.11&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.arquillian.junit&lt;/groupId&gt;
              &lt;artifactId&gt;arquillian-junit-container&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.spec&lt;/groupId&gt;
              &lt;artifactId&gt;jboss-javaee-6.0&lt;/artifactId&gt;
              &lt;version&gt;1.0.0.Final&lt;/version&gt;
              &lt;type&gt;pom&lt;/type&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.arquillian.container&lt;/groupId&gt;
              &lt;artifactId&gt;arquillian-weld-ee-embedded-1.1&lt;/artifactId&gt;
              &lt;version&gt;1.0.0.CR3&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.weld&lt;/groupId&gt;
              &lt;artifactId&gt;weld-core&lt;/artifactId&gt;
              &lt;version&gt;1.1.5.Final&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-simple&lt;/artifactId&gt;
              &lt;version&gt;1.6.4&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.jboss.arquillian&lt;/groupId&gt;
                  &lt;artifactId&gt;arquillian-bom&lt;/artifactId&gt;
                  &lt;version&gt;1.1.8.Final&lt;/version&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
                  &lt;type&gt;pom&lt;/type&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>It's possible that I have some dependencies that I don't need. As I'm inexperienced I must honestly admit, I was quite desperate and looked for any possible answer, and during that process I added some dependencies that may not be used at all.</p>
  
  <p>Here is the class supposed to make the EntityManager</p>
  
  <pre><code>package ~path.examples.service;
  
  import ~path.examples.testjpa.domain.Person;
  
  import javax.persistence.*;
  
  /**
   * Created by ME on 2015-04-22.
   */
  public class JpaTest {
      public static void main(String args[]) {
          EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("jpaTest");
          EntityManager em = entityManagerFactory.createEntityManager();
          EntityTransaction userTransaction = em.getTransaction();
  
          userTransaction.begin();
          Person person = new Person();
          person.setFirstName("Charles");
          person.setSurname("Dickens");
          em.persist(person);
          userTransaction.commit();
          em.close();
          entityManagerFactory.close();
      }
  }
  </code></pre>
  
  <p>Also:</p>
  
  <ol>
  <li><p>Im pretty sure that all the files are in the appropriate locations, I also had some problems with me, but I seem to have eliminated that problem (other errors pop out than before) :)</p></li>
  <li><p>It's probably something obvious that I'm missing, thanks in advance for any help!</p></li>
  </ol>
  
  <p>edit: It's very likely that the problem lies in persistance.xml file, so here it is (thanks for pointing it out). The location of the file is src/main/resources/META-INF</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="JpaTest" transaction-type="RESOURCE_LOCAL"&gt;
          &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
          &lt;class&gt;~path.examples.testjpa.domain.Person&lt;/class&gt;
          &lt;properties&gt;
              &lt;property name="hibernate.show_sql" value="true" /&gt;
              &lt;property name="hibernate.format_sql" value="true" /&gt;
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" /&gt;
              &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt;
          &lt;/properties&gt;
  
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>