title: Hibernate trying to load Jandex on EntityManagerFactory creation
body: <p>Currently refreshing my JPA and Hibernate Know-How, I am writing some example code in the form of a todo list swing application.</p>
  
  <p>This is the minimal example that reproduces my problem:</p>
  
  <pre><code>public static void main(String[] args) {
      EntityManagerFactory emf = Persistence.createEntityManagerFactory("SwingTodoPU");
  }
  </code></pre>
  
  <p>This is the stacktrace I get when running the application (I am using Netbeans' default build configuration and no additional build tools like Maven):</p>
  
  <pre><code>Okt 09, 2015 12:10:21 PM org.hibernate.ejb.HibernatePersistence logDeprecation
  WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
  Okt 09, 2015 12:10:21 PM org.hibernate.ejb.HibernatePersistence logDeprecation
  WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
  Okt 09, 2015 12:10:21 PM org.hibernate.ejb.HibernatePersistence logDeprecation
  WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
  Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/jandex/IndexView
      at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:51)
      at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:129)
      at org.hibernate.ejb.HibernatePersistence.getEntityManagerFactoryBuilderOrNull(HibernatePersistence.java:93)
      at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:86)
      at org.hibernate.ejb.HibernatePersistence.getEntityManagerFactoryBuilderOrNull(HibernatePersistence.java:101)
      at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:67)
      at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
      at at.swingtodo.SwingTodo.main(SwingTodo.java:39)
  Caused by: java.lang.ClassNotFoundException: org.jboss.jandex.IndexView
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      ... 10 more
  Java Result: 1
  </code></pre>
  
  <p>The persistence unit is configured in <code>src/META-INF/persistence.xml</code> as follows:</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://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"&gt;
    &lt;persistence-unit name="SwingTodoPU" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt;
      &lt;class&gt;at.swingtodo.entities.Item&lt;/class&gt;
      &lt;shared-cache-mode&gt;NONE&lt;/shared-cache-mode&gt;
      &lt;validation-mode&gt;NONE&lt;/validation-mode&gt;
      &lt;properties&gt;
        &lt;property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/&gt;
        &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/tododb?zeroDateTimeBehavior=convertToNull"/&gt;
        &lt;property name="javax.persistence.jdbc.password" value="tododb"/&gt;
        &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/&gt;
        &lt;property name="javax.persistence.jdbc.user" value="tododb"/&gt;
        &lt;property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/&gt;
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p><code>hibernate.cfg.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
    &lt;session-factory&gt;
      &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
      &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
      &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/tododb?zeroDateTimeBehavior=convertToNull&lt;/property&gt;
      &lt;property name="hibernate.connection.username"&gt;tododb&lt;/property&gt;
      &lt;property name="hibernate.connection.password"&gt;tododb&lt;/property&gt;
    &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>I understand that Hibernate is trying to use Jandex but I do not understand why it is, even in my minimal example. As you can see, I am not using metadata generation as the OP in this related question <a href="https://stackoverflow.com/questions/15168365/why-is-hibernate-4-2-using-jandex-and-classmate-if-its-maven-pom-defines-them-as">"Why is hibernate 4.2 using jandex and classmate [...]"</a>. I have also been unable to resolve the warnings that are output before the Exception is thrown (my code is not referencing <code>org.hibernate.ejb.HibernatePersistence</code>)</p>
  
  <p>If possible, I would like to avoid the obvious workaround of satisfying Jandex and its dependencies. </p>
  
  <p>I am using Hibernate 4.3, JPA 2.1, JDK 1.7, and NetBeans 8.0.2.</p>