title: java.lang.NullPointerException at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure
body: <p>I have a JPA2 + Hibernate web project and I would like to test if it persists.</p>
  
  <p>This is the entity:</p>
  
  <pre><code>package model;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.Id;
  
  
  @Entity(name="alunos")
  public class Aluno {
     @Id @GeneratedValue
     private Long id;
  
     private String nome;
  
  
     public void setId(Long id) {
         this.id = id;
     }
  
     public Long getId() {
         return id;
     }
  
     public String getNome() {
         return nome;
     }
  
     public void setNome(String nome) {
         this.nome = nome;
     }
  }
  </code></pre>
  
  <p>This is the <code>persistence.xml</code>:</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://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"&gt;
  
      &lt;persistence-unit name="PrimeiroProjetoJSF" transaction-type="RESOURCE_LOCAL"&gt;
  
          &lt;class&gt;model.Aluno&lt;/class&gt;
  
          &lt;properties&gt;
  
  
              &lt;property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@------------"/&gt;
              &lt;property name="javax.persistence.jdbc.user" value="-----"/&gt; 
              &lt;property name="javax.persistence.jdbc.password" value="------"/&gt;
              &lt;property name="javax.persistence.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/&gt;
  
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" /&gt;
              &lt;property name="hibernate.show_sql" value="true" /&gt;
              &lt;property name="hibernate.format_sql" value="true" /&gt;
  
              &lt;property name="hibernate.hbm2ddl.auto" value="create" /&gt; 
  
          &lt;/properties&gt;
  
      &lt;/persistence-unit&gt;
  
  &lt;/persistence&gt;
  </code></pre>
  
  <p>This is the class with a <code>main()</code> method to test the persistence:</p>
  
  <pre><code>import javax.persistence.EntityManager;
  import javax.persistence.EntityManagerFactory;
  import javax.persistence.Persistence;
  
  import model.Aluno;
  
  
  public class GeraTabelas {
      public static void main(String[] args) {
          EntityManagerFactory factory = Persistence.createEntityManagerFactory("PrimeiroProjetoJSF");
          EntityManager fac = factory.createEntityManager();
  
          Aluno arthur = new Aluno();
          arthur.setNome("Arthur");
          fac.persist(arthur);
          factory.close();
  
      }
  }
  </code></pre>
  
  <p>When I run it, the following exception is thrown: </p>
  
  <pre><code>Exception in thread "main" javax.persistence.PersistenceException: Unable to build entity manager factory 
         at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:81) 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 GeraTabelas.main(GeraTabelas.java:10)
  Caused by: java.lang.NullPointerException
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:244)
      at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:206)
      at
  org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178)
      at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843)
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:399)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactory&gt;uilderImpl.java:842)
      at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:73)
      ... 4 more
  </code></pre>
  
  <p>How is this caused and how can I solve it?</p>