[quote=jpmpassos]vou colocar em baixo o código de erro que aparece em meu navegador…
em especial eu sublinhei uma parte no código que da uma dica para resolver o problema… mas ainda não consegui resolver…
type Exception report
message org.hibernate.TransactionException: JDBC begin failed:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: org.hibernate.TransactionException: JDBC begin failed:
com.evento.filtros.ConexaoHibernateFilter.doFilter(ConexaoHibernateFilter.java:44)
root cause
org.hibernate.TransactionException: JDBC begin failed:
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:96)
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1463)
sun.reflect.GeneratedMethodAccessor193.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:344)
$Proxy78.beginTransaction(Unknown Source)
com.evento.filtros.ConexaoHibernateFilter.doFilter(ConexaoHibernateFilter.java:32)
root cause
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:The last packet successfully received from the server was 73.125.696 milliseconds ago. The last packet sent successfully to the server was 73.125.696 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117)
com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3829)
com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2449)
com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2713)
com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:5060)
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:91)
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1463)
sun.reflect.GeneratedMethodAccessor193.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:344)
$Proxy78.beginTransaction(Unknown Source)
com.evento.filtros.ConexaoHibernateFilter.doFilter(ConexaoHibernateFilter.java:32)
root cause
java.net.SocketException: Software caused connection abort: socket write error
java.net.SocketOutputStream.socketWrite0(Native Method)
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3810)
com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2449)
com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2713)
com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:5060)
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:91)
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1463)
sun.reflect.GeneratedMethodAccessor193.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:344)
$Proxy78.beginTransaction(Unknown Source)
com.evento.filtros.ConexaoHibernateFilter.doFilter(ConexaoHibernateFilter.java:32)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.40 logs.
em especial eu sublinhei uma parte no código que da uma dica para resolver o problema… mas ainda não consegui resolver…
The last packet successfully received from the server was 73.125.696 milliseconds ago. The last packet sent successfully to the server was 73.125.696 milliseconds ago. is longer than the server configured value of ‘wait_timeout’. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property ‘autoReconnect=true’ to avoid this problem.[/quote]
Interessante… Vou dar uma olhada. To na mesma tb : /
Pelo que pude ver ele não conseguia efetuar o código this.sf.getCurrentSession().getTransaction().commit(); pois a sessão tinha espirado e não tinha fechado… ou alguma coisa assim…não sei ao certo… abaixo tem o que fiz que resolveu meu problema…
OBS: utilizo como base para minha aplicação o Livro Programação Java Para Web
Tinha este código no meu filtro ConexaoHibernateFilter
[quote=jpmpassos]Aparentemente consegui resolver o meu problema…
Pelo que pude ver ele não conseguia efetuar o código this.sf.getCurrentSession().getTransaction().commit(); pois a sessão tinha espirado e não tinha fechado… ou alguma coisa assim…não sei ao certo… abaixo tem o que fiz que resolveu meu problema…
OBS: utilizo como base para minha aplicação o Livro Programação Java Para Web
Tinha este código no meu filtro ConexaoHibernateFilter
Entao, deixei a classe ConexaoHibernateFilter = a sua e o erro continua.
Fui no log do tomcat onde app ta rodando e achei isso aqui :
Jul 09, 2013 7:33:18 AM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-80
Jul 09, 2013 7:33:19 AM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Jul 09, 2013 7:33:19 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/rm] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Jul 09, 2013 7:33:19 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/rm] appears to have started a thread named [MySQL Statement Cancellation Timer] but has failed to stop it. This is very likely to create a memory leak.
Jul 09, 2013 7:33:19 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/rm] appears to have started a thread named [MySQL Statement Cancellation Timer] but has failed to stop it. This is very likely to create a memory leak.
Jul 09, 2013 7:33:19 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/rm] created a ThreadLocal with key of type [com.sun.faces.util.Util$1] (value [com.sun.faces.util.Util$1@21e0926d]) and a value of type [java.util.HashMap] (value [{com.sun.faces.patternCache={ = }}]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Jul 09, 2013 7:33:20 AM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-80
Jul 09, 2013 7:33:26 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;;.
Jul 09, 2013 7:33:26 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-80
Jul 09, 2013 7:33:26 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 449 ms
Jul 09, 2013 7:33:26 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 09, 2013 7:33:26 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.36
Jul 09, 2013 7:33:26 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
Jul 09, 2013 7:33:27 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor rm.xml
Jul 09, 2013 7:33:27 AM org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener “com.sun.faces.config.ConfigureListener” is already configured for this context. The duplicate definition has been ignored.
[b]
ps:
O tomcat q ta instaldo no server q a app ta rodando eh versao 6. O server q ta insataldo na maquina q eu fiz
a app (localhost) eh a versao 7. Sera q eh por causa disso ? Vou deixar a classe ConexaoHibernateFilter como
estava antes ( =ao livro) pois nao tive sucesso com as modificacoes. Vou colocar o uma parte do log do tomcat aqui.
[/b]
Sobre meu Toncat Em minha aplicação utilizo toncat mais atual, e sempre quando sai um novo eu passo a utiliza-lo…
Sobre o Erro
Se vc perceber o erro já mudou… pode ser q o problema anterior foi resolvido… porque as alterações na classe ConexaoHibernateFilter que fiz não causa erro pois simplesmente quando ele da um erro geral, como antes tava dando no JDBC commit failed ela entra na exceção, que fecha a sessão que não teve como fechar pois parou na linha do commit e tenta tudo novamente…
não vejo as alterações da minha classe podem casar esse erro…