title: How to solve persistence unit on Tomcat
body: <p>I had this web project setup on Glassfish, but I decided to move to Tomcat since I was having some problems.</p>
  
  <p>But now my persistence class is throwing the following error</p>
  
  <pre><code>Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named JetCarBd
  </code></pre>
  
  <p>I've tried placing the persistence.xml on different folders, but it haven't worked.</p>
  
  <p>persistence.xml</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="JetCarBd" transaction-type="RESOURCE_LOCAL"&gt;
  &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;
  &lt;class&gt;br.com.jetcar.entity.Cliente&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.Endereco&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.Veiculo&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.Aluguel&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.Venda&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.Interesse&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.Funcionario&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.ItensAluguel&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.AcessorioAluguel&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.TestDrive&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.AcessorioVeiculo&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.Acessorio&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.Oficina&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.Manutencao&lt;/class&gt;
  &lt;class&gt;br.com.jetcar.entity.Reserva&lt;/class&gt;
  &lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt;
  &lt;properties&gt;
    &lt;property name="javax.persistence.jdbc.url"  value="jdbc:postgresql://localhost:5432/jetcar"/&gt;
    &lt;property name="javax.persistence.jdbc.password" value="postgres"/&gt;
    &lt;property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/&gt;
    &lt;property name="javax.persistence.jdbc.user" value="postgres"/&gt;
   &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>ConnectionUtil.java</p>
  
  <pre><code>package br.com.jetcar.connection;
  
  import javax.persistence.EntityManager;
  import javax.persistence.EntityManagerFactory;
  import javax.persistence.Persistence;
  
  /**
   * @author Jorge Oliveira
   */
  public class ConnectUtil {
  
  private  final EntityManagerFactory emf;
  
  public ConnectUtil(){
      emf = Persistence.createEntityManagerFactory("JetCarBd");
  }
  
  public EntityManager getEntityManager() {
      return emf.createEntityManager();
  }
  
  
  }
  </code></pre>
  
  <p>My persistence.xml is located under src/META-INF</p>