title: javax.persistence.PersistenceException: No Persistence provider for EntityManager named WebApplication1PU
body: <p>I am deploying a simple web application to WildFly 10 from NetBeans to try and teach myself Java EE. However, I get the following error when trying to run a jpql query from NetBeans:</p>
  
  <pre><code>javax.persistence.PersistenceException: No Persistence provider for EntityManager named WebApplication1PU
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:85)
  </code></pre>
  
  <p>This is despite the fact that I have defined a persistence provider. This is my <code>persistence.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"&gt;
    &lt;persistence-unit name="WebApplication1PU" transaction-type="JTA"&gt;
      &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt;
      &lt;jta-data-source&gt;java:/jboss/db&lt;/jta-data-source&gt;
      &lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt;
      &lt;properties&gt;
          &lt;property name="hibernate.dialect" value="org.hibernate.dialect.SQLServer2012Dialect"/&gt;
          &lt;property name="hibernate.show_sql" value="true"/&gt;
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;    
  </code></pre>
  
  <p>When I test my datasource in WildFly it works:</p>
  
  <p><a href="https://i.stack.imgur.com/sxqAJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sxqAJ.png" alt="enter image description here"></a></p>
  
  <p>My JPA Subsystem's default datasource is configured as java:/jboss/db</p>
  
  <p>I have it listed as a persistence unit in WildFly:</p>
  
  <p><a href="https://i.stack.imgur.com/3HRBy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3HRBy.png" alt="enter image description here"></a></p>
  
  <p>I am using JTDS driver for MS SQL Server and I do get this error on startup of the server that I can't get rid of: </p>
  
  <pre><code>10:33:07,600 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 33) WFLYCTL0013: Operation ("add") failed - address: ([
      ("subsystem" =&gt; "datasources"),
      ("jdbc-driver" =&gt; "JTDS")
  ]) - failure description: "WFLYJCA0041: Failed to load module for driver [net.sourceforge.jtds]"
  </code></pre>
  
  <p>However, as I said, testing the datasource works, so this shouldn't matter. Can anyone help me?</p>