title: No persistence provider for EntityManager named testPU
body: <p>I'm developing a small application on JBoss 7.1.0 using Guice as DI Framework and I'm building it using maven. 
  All my DAO's get the EntityManager injected as constructor Injection:</p>
  
  <pre><code>public class MyDao{
  ...
  @Inject
  public MyDao(EntityManager em){}
  ...
  }
  </code></pre>
  
  <p>To test these classes I need to create an EntityManager in my tests.</p>
  
  <p>To create the EntityManager I added my persistence.xml to
  src/test/resources/META-INF/persistence.xml</p>
  
  <p>My persistence.xml looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
      &lt;persistence xmlns="http://java.sun.com/xml/ns/persistence"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
      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="testPU" transaction-type="RESOURCE_LOCAL"&gt;
          &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
          &lt;class&gt;com.foo.Foo&lt;/class&gt;
          &lt;exclude-unlisted-classes&gt;true&lt;/exclude-unlisted-classes&gt;
          &lt;properties&gt;
              &lt;property name="hibernate.connection.url" value="jdbc:hsqldb:mem:unit-testing-jpa" /&gt;
              &lt;property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" /&gt;
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" /&gt;
              &lt;property name="hibernate.hbm2ddl.auto" value="create-drop" /&gt;
              &lt;property name="hibernate.connection.username" value="sa" /&gt;
              &lt;property name="hibernate.connection.password" value="" /&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>In my setup method of the tests I do the following:</p>
  
  <pre><code>private EntityManager em;
  
  @Before
  public void setup() {
      em = Persistence.createEntityManagerFactory("testPU")
              .createEntityManager();
  }
  </code></pre>
  
  <p>But I always get the error "No persistence provider for EntityManager named testPU". (Running the tests in eclipse and using maven)</p>
  
  <p>I cannot figure out what I am doing wrong. Can you please help me?</p>
  
  <p>Thx in advance!</p>