preciso de ajuda!!!
Estou desenvolvendo um projeto WEB usando NetBeans, servidor TomCat, API JPA com Hibernate, estou tendo o seguinte problema ao rodar a aplicação:
o objetivo é gravar um conta no banco de dados “MySql”.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.ExceptionInInitializerError
javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
root cause
javax.faces.el.EvaluationException: java.lang.ExceptionInInitializerError
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
javax.faces.component.UICommand.broadcast(UICommand.java:315)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:11
javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
root cause
java.lang.ExceptionInInitializerError
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:124)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
main.java.br.com.caelum.financas.infra.JPAUtil.(JPAUtil.java:12)
main.java.br.com.caelum.financas.mb.ContasBean.grava(ContasBean.java:21)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.apache.el.parser.AstValue.invoke(AstValue.java:191)
org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:9
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:8
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
javax.faces.component.UICommand.broadcast(UICommand.java:315)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:11
javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
root cause
java.lang.ClassCastException: org.hibernate.annotations.common.reflection.java.JavaReflectionManager cannot be cast to org.hibernate.annotations.common.reflection.MetadataProviderInjector
org.hibernate.cfg.AnnotationConfiguration.reset(AnnotationConfiguration.java:303)
org.hibernate.cfg.Configuration.(Configuration.java:216)
org.hibernate.cfg.Configuration.(Configuration.java:220)
org.hibernate.cfg.AnnotationConfiguration.(AnnotationConfiguration.java:164)
org.hibernate.ejb.Ejb3Configuration.(Ejb3Configuration.java:107)
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:124)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
main.java.br.com.caelum.financas.infra.JPAUtil.(JPAUtil.java:12)
main.java.br.com.caelum.financas.mb.ContasBean.grava(ContasBean.java:21)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.apache.el.parser.AstValue.invoke(AstValue.java:191)
org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:9
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:8
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
javax.faces.component.UICommand.broadcast(UICommand.java:315)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:11
javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.
Apache Tomcat/6.0.26
isso acontece assim que clico no commandButton Gravar do meu XHTML, que faz o Binding com o meu ManagedBean, que também vou deixar aqui para ser observado:
public void grava() {
EntityManager em = new JPAUtil().getEntityManager();
em.getTransaction().begin();
ContaDAO dao = new ContaDAO(em);
dao.adiciona(conta);
this.contas = dao.lista();
em.getTransaction().commit();
em.close();
limpaFormularioDoJSF();
}
de acordo com configurações usadas em outros projetos, minha JPAUtil esta correta e de arcodo com minha unidade de persistencia.
por favor, me ajudem!!!
grande abraço.