Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ExceptionInInitializerError  RSS feed

Rene Ribeiro
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good afternoon !!

How do I find out what is this error?
I gather that is the JPAUtil, but could not identify because sometimes can not boot it.

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns=""
<title>Cadastro de Contas</title>
<h:panelGrid columns="2">
<h:outputLabel value="Descricao"/>
<h:inputText value="#{contaBean.conta.descricao}"/>
<h:commandButton value="Salvar" actionListener="#{contaBean.salvar()}"/>


package ManagedBean;

import Classes.Conta;
import Util.JPAUtil;
import javax.faces.bean.*;
import javax.persistence.EntityManager;

@ManagedBean(name = "contaBean")

public class ContaCorrente {

private Conta conta = new Conta();

public Conta getConta() {
return conta;

public void setConta(Conta conta) {
this.conta = conta;

public void salvar() {
EntityManager manager = (EntityManager) JPAUtil.getEntityManagerFactory();
conta = new Conta();

package Util;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class JPAUtil{

private static final EntityManagerFactory FACTORY =

public static EntityManagerFactory getEntityManagerFactory(){
return (EntityManagerFactory) FACTORY.createEntityManager();



<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns=""

<persistence-unit name="ContaCorrente">
<property name="javax.persistence.schema-generation.database.action" value="create"/>

<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/conta</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">mysql</property>
Tim Holloway
Posts: 18531
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Rene!

There's a "Code" button on our message editor. It inserts tags that make samples of pre-formatted text such as Java code and XML easier to read.

You didn't show the actual error that you are getting, so it's hard to say what's wrong.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!