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

Erro ao rodar a aplicação

HTTP Status 500 - viewId:/autor.xhtml - A exibição de /autor.xhtml não pôde ser restaurada.

type Exception report

message viewId:/autor.xhtml - A exibição de /autor.xhtml não pôde ser restaurada.

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

exception javax.servlet.ServletException: viewId:/autor.xhtml - A exibição de /autor.xhtml não pôde ser restaurada. javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

root cause javax.faces.application.ViewExpiredException: viewId:/autor.xhtml - A exibição de /autor.xhtml não pôde ser restaurada. com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:205) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) 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)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.

2 respostas

C:\xampp\mysql\bin>mysql -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 37 Server version: 10.4.19-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use livrariadb; Database changed MariaDB [livrariadb]> show tables; Empty set (0.001 sec)

MariaDB [livrariadb]> show tables; Empty set (0.001 sec)

MariaDB [livrariadb]> create database livrariadb -> create database livrariadb; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'create database livrariadb' at line 2 MariaDB [livrariadb]> show tables; Empty set (0.001 sec)

MariaDB [livrariadb]> show tables; Empty set (0.001 sec)

MariaDB [livrariadb]>

solução!

<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="" />

        <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>