2
respostas

HTTP Status 500 - javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection

alguém poderia me ajudar ? type Exception report

message javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection

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

exception

javax.servlet.ServletException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) root cause

javax.faces.el.EvaluationException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101) com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:101) javax.faces.component.UICommand.broadcast(UICommand.java:315) javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:791) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1256) 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:593) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) root cause

2 respostas

<persistence-unit name="livraria" transaction-type="RESOURCE_LOCAL">

       <provider>org.hibernate.ejb.HibernatePersistence</provider>

    <class>br.com.caelum.livraria.modelo.Livro</class>
    <class>br.com.caelum.livraria.modelo.Autor</class>

    <properties>
        <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
        <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/livrariadb" />
        <property name="javax.persistence.jdbc.user" value="root" />
        <property name="javax.persistence.jdbc.password" value="123456" />

        <property name="hibernate.hbm2ddl.auto" value="update" />
        <property name="hibernate.show_sql" value="true" />
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
    </properties>
</persistence-unit>

O driver MYSQL está instalado ? As credenciais (login e senha) estão corretas ?