title: No Persistence provider for EntityManager?
body: <p>I'm trying to set up a basic JPA. But I cannot even get the <code>EntityManger</code>. What might be wrong with the following configuration?</p>
  
  <pre><code>private static final EntityManager emf = Persistence
  .createEntityManagerFactory("transactions-optional").createEntityManager();
  </code></pre>
  
  <p><code>src/META-INF/persistence.xml</code> (also tried: <code>src/main/webapp/WEB-INF/classes/META-INF/</code>):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;persistence 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" version="1.0"&gt;
  
      &lt;persistence-unit name="transactions-optional"&gt;
          &lt;provider&gt;org.datanucleus.api.jpa.PersistenceProviderImp&lt;/provider&gt;
          &lt;properties&gt;
              &lt;property name="datanucleus.NontransactionalRead" value="true"/&gt;
              &lt;property name="datanucleus.NontransactionalWrite" value="true"/&gt;
              &lt;property name="datanucleus.ConnectionURL" value="appengine"/&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named transactions-optional
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
      at de.verism.server.database.EMFService.&lt;clinit&gt;(EMFService.java:13)
  </code></pre>
  
  <p>Maven Config:</p>
  
  <pre><code>   &lt;dependency&gt;
          &lt;groupId&gt;javax.jdo&lt;/groupId&gt;
          &lt;artifactId&gt;jdo2-api&lt;/artifactId&gt;
          &lt;version&gt;2.3-eb&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;!--
                  exclude the legacy javax.transaction:transaction-api
                  and replace it with javax.transaction:jta (it
                  appears to be the same thing)
              --&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
                  &lt;artifactId&gt;transaction-api&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
          &lt;artifactId&gt;jta&lt;/artifactId&gt;
          &lt;version&gt;1.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.appengine.orm&lt;/groupId&gt;
          &lt;artifactId&gt;datanucleus-appengine&lt;/artifactId&gt;
          &lt;version&gt;2.1.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.datanucleus&lt;/groupId&gt;
          &lt;artifactId&gt;datanucleus-core&lt;/artifactId&gt;
          &lt;version&gt;3.2.4&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
                  &lt;artifactId&gt;transaction-api&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.appengine&lt;/groupId&gt;
          &lt;artifactId&gt;datanucleus-jpa&lt;/artifactId&gt;
          &lt;version&gt;1.1.5&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.appengine&lt;/groupId&gt;
          &lt;artifactId&gt;geronimo-jpa_3.0_spec&lt;/artifactId&gt;
          &lt;version&gt;1.1.1&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.appengine&lt;/groupId&gt;
          &lt;artifactId&gt;appengine-api-1.0-sdk&lt;/artifactId&gt;
          &lt;version&gt;${gae.version}&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>Updated config:</p>
  
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;com.google.appengine.orm&lt;/groupId&gt;
              &lt;artifactId&gt;datanucleus-appengine&lt;/artifactId&gt;
              &lt;version&gt;2.1.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.datanucleus&lt;/groupId&gt;
              &lt;artifactId&gt;datanucleus-core&lt;/artifactId&gt;
              &lt;version&gt;3.1.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.datanucleus&lt;/groupId&gt;
              &lt;artifactId&gt;datanucleus-api-jpa&lt;/artifactId&gt;
              &lt;version&gt;3.1.1&lt;/version&gt;
          &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.geronimo.specs&lt;/groupId&gt;
      &lt;artifactId&gt;geronimo-jpa_2.0_spec&lt;/artifactId&gt;
      &lt;version&gt;1.1&lt;/version&gt;
      &lt;scope&gt;runtime&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>