Boa noite caros,
Estava com um sistema JSF + Hibernate funcionando em um Tomcat 7 até agora.
Fui reiniciar o servidor e ele começou dar
21:48:11,912 INFO DefaultLoadEventListener:156 - HHH000327: Error performing load command : org.hibernate.exception.JDBCConnectionException: Could not open connection
Mai 17, 2012 9:48:11 PM javax.faces.event.MethodExpressionActionListener processAction
Grave: 'javax.persistence.PersistenceException' recebido ao invocar escuta de ação '#{loginAction.login}' para o componente 'j_idt14'
Mai 17, 2012 9:48:11 PM javax.faces.event.MethodExpressionActionListener processAction
Grave: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
...
Caused by: org.hibernate.exception.JDBCConnectionException: Could not open connection
...
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/erp
...
Mai 17, 2012 9:48:11 PM com.sun.faces.context.AjaxExceptionHandlerImpl log
Grave: JSF1073: javax.faces.event.AbortProcessingException obtido durante o processamento de INVOKE_APPLICATION 5: UIComponent-ClientId=formLogin:j_idt14, Message=javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
Que seria resolvido com Class.forName(“com.mysql.jdbc.Driver”). Mas o sistema nunca teve essa chamada.
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="ERP">
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/erp" />
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.username" value="erp" />
<property name="hibernate.connection.password" value="123" />
<property name="hibernate.hbm2ddl.auto" value="validete" />
</properties>
</persistence-unit>
</persistence>
Existe um jeito de fazer esse Class.forName automaticamente no servidor?
Já tentei colocar o mysql-jdbc dentro de lib do servidor e dentro do war.
Att,
Guilherme Tonioli