Solucionado (ver solução)
Solucionado
(ver solução)
5
respostas

org.hibernate.exception.JDBCConnectionException: Cannot open connection

Olá pessoal,

Estou modificando alguns exemplos do cuso de JSF do Alura, mas estou encontrando o seguinte erro:

Erro 500: http://pastebin.com/c3ZiBfRT

Espero contar com a ajuda de vocês :)

5 respostas

Rafael pelo que eu pude perceber no erro, tem algum problema no drive do mysql. Tenta passar ele manualmente para o build path do projeto.

Resolvi o problema de certa forma. A sintaxe do persistence.xml estava incorreta.

Alterei de: Para:

mas agora estou com um novo poblema:

HTTP Status 500 - java.lang.IllegalArgumentException: attempt to create create event with null entity

type Exception report

message java.lang.IllegalArgumentException: attempt to create create event with null entity

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: java.lang.IllegalArgumentException: attempt to create create event with null entity javax.faces.webapp.FacesServlet.service(FacesServlet.java:659) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause

javax.faces.el.EvaluationException: java.lang.IllegalArgumentException: attempt to create create event with null entity javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101) com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) javax.faces.component.UICommand.broadcast(UICommand.java:315) javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282) com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause

java.lang.IllegalArgumentException: attempt to create create event with null entity org.hibernate.event.PersistEvent.(PersistEvent.java:45) org.hibernate.event.PersistEvent.(PersistEvent.java:38) org.hibernate.impl.SessionImpl.persist(SessionImpl.java:619) org.hibernate.impl.SessionImpl.persist(SessionImpl.java:623) org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220) br.com.arena.dao.PessoaDAO.cadastrar(PessoaDAO.java:22) br.com.arena.controller.PessoaBean.cadastrar(PessoaBean.java:15) 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:247) org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:267) com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87) com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) javax.faces.component.UICommand.broadcast(UICommand.java:315) javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282) com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/8.0.36 logs.

Segue o erro mais detalhado: http://pastebin.com/VJM8YisG

solução!

Solução:

A estrutura do persistence.xml não estava de acordo com a versão da dependência no pom.xml

persistence.xml:

pom.xml:

org.hibernate hibernate-entitymanager 3.4.0.GA org.hibernate hibernate-validator 4.0.2.GA