title: Wildfly: disable persistence unit lookup
body: <p>At the very beginning of artifact deploy, Wildfly validates all persistence unit described in persistence.xml. One on the responsible classes is <code>org.jboss.as.jpa.processor.PersistenceUnitServiceHandler</code> from <code>wildfly-jpa</code> library.</p>
  
  <p>The main question: is it possible to disable this validation somehow? Or just mark persistence unit as ignored? </p>
  
  <p><strong>Details an root cause:</strong></p>
  
  <p>We are going to build environment-free artifacts. So the configuration inside persistence.xml will be overridden in java code at the very beginning. Default configuration is dummy and looks like this: </p>
  
  <pre><code>&lt;persistence-unit name="cassandra_unit" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;provider&gt;com.impetus.kundera.KunderaPersistence&lt;/provider&gt;
      &lt;class&gt;sample.model.Manager&lt;/class&gt;
      &lt;exclude-unlisted-classes&gt;true&lt;/exclude-unlisted-classes&gt;
      &lt;properties&gt;
          &lt;property name="kundera.nodes" value="localhost"/&gt;
          &lt;property name="kundera.port" value="9165"/&gt;
          &lt;property name="kundera.username" value="test"/&gt;
          &lt;property name="kundera.password" value="test"/&gt;
          &lt;property name="kundera.keyspace" value="keyspace"/&gt;
          &lt;property name="kundera.dialect" value="cassandra"/&gt;
          &lt;property name="kundera.client.lookup.class" value="com.impetus.kundera.client.cassandra.dsdriver.DSClientFactory"/&gt;
      &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p>But wildfly validates persistence units and calls <code>KunderaPersistence.createContainerEntityManagerFactory</code>. Kundera in it's turn checks connection against localhost:9165 and fails. So deployment fails too.</p>
  
  <p>Any workaround is acceptable.</p>