Announcement Announcement Module
Collapse
No announcement yet.
Could not open Hibernate Session for transaction; JDBC begin failed: Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Could not open Hibernate Session for transaction; JDBC begin failed:

    Hi, getting this exception

    Could not open Hibernate Session for transaction; nested exception is
    org.hibernate.TransactionException: JDBC begin failed:

    periodically from a running prod. application. The app. is running Spring 1.2.5, Hibernate 3.0.5, MSSql. Using Spring managed transactions and commons dbcp for connection pooling.
    Remember reading at some point that the exception mait be caused by dbcp?
    Has anybody else experianced this or may have a clue to what is causing this exception.

    Thanks.

  • #2
    Having a full stacktrace might help.

    Comment


    • #3
      Stacktrace

      We are encountering the same problem. It seems to occur the first time someone tries to log into the system for the day. All subsequent logins work fine. Here is the full stacktrace:

      2008-02-27 07:50:06,554 ERROR [com.innovis.web.util.LoggingInterceptor] 1AFCEB25A7CC4AF91C17ABBAFE8EF8D7.node1 112D93428665814EEC97B71C9117A694.node1 Exception in method: execute(). Exception: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin failed:
      2008-02-27 07:50:06,560 ERROR [com.innovis.web.util.LoggingInterceptor] 1AFCEB25A7CC4AF91C17ABBAFE8EF8D7.node1 112D93428665814EEC97B71C9117A694.node1 org.springframework.transaction.CannotCreateTransa ctionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin failed:
      Caused by: org.hibernate.TransactionException: JDBC begin failed:
      at org.hibernate.transaction.JDBCTransaction.begin(JD BCTransaction.java:68)
      at org.hibernate.impl.SessionImpl.beginTransaction(Se ssionImpl.java:1326)
      at org.springframework.orm.hibernate3.HibernateTransa ctionManager.doBegin(HibernateTransactionManager.j ava:497)
      at org.springframework.transaction.support.AbstractPl atformTransactionManager.getTransaction(AbstractPl atformTransactionManager.java:349)
      at org.springframework.transaction.interceptor.Transa ctionAspectSupport.createTransactionIfNecessary(Tr ansactionAspectSupport.java:255)
      at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:102)
      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :176)
      at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:210)
      at $Proxy77.getUserByUsername(Unknown Source)
      at com.innovis.web.action.LoginAction.execute(LoginAc tion.java:53)
      at com.innovis.web.action.LoginAction$$FastClassByCGL IB$$279209c2.invoke(<generated>)
      at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy. java:149)
      at org.springframework.aop.framework.Cglib2AopProxy$C glibMethodInvocation.invokeJoinpoint(Cglib2AopProx y.java:675)
      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :154)
      at org.springframework.aop.framework.adapter.ThrowsAd viceInterceptor.invoke(ThrowsAdviceInterceptor.jav a:129)
      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :176)
      at org.springframework.aop.framework.adapter.AfterRet urningAdviceInterceptor.invoke(AfterReturningAdvic eInterceptor.java:51)
      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :176)
      at org.springframework.aop.framework.adapter.MethodBe foreAdviceInterceptor.invoke(MethodBeforeAdviceInt erceptor.java:53)
      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :176)
      at org.springframework.aop.framework.Cglib2AopProxy$D ynamicAdvisedInterceptor.intercept(Cglib2AopProxy. java:616)
      at com.innovis.web.action.FirstTimeLoginAction$$Enhan cerByCGLIB$$be7fe6e4.execute(<generated>)
      at org.springframework.web.struts.DelegatingActionPro xy.execute(DelegatingActionProxy.java:106)
      at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:419)
      at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:224)
      at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1194)
      at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:432)
      at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
      at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
      at sun.reflect.GeneratedMethodAccessor159.invoke(Unkn own Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.apache.catalina.security.SecurityUtil$1.run(Se curityUtil.java:243)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject .java:500)
      at org.apache.catalina.security.SecurityUtil.execute( SecurityUtil.java:275)
      at org.apache.catalina.security.SecurityUtil.doAsPriv ilege(SecurityUtil.java:161)
      at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:245)
      at org.apache.catalina.core.ApplicationFilterChain.ac cess$000(ApplicationFilterChain.java:50)
      at org.apache.catalina.core.ApplicationFilterChain$1. run(ApplicationFilterChain.java:156)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:152)
      at com.innovis.web.filter.SecurityFilter.doFilterInte rnal(SecurityFilter.java:55)
      at com.innovis.web.filter.BaseFilter.doFilter(BaseFil ter.java:57)
      at sun.reflect.GeneratedMethodAccessor160.invoke(Unkn own Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.apache.catalina.security.SecurityUtil$1.run(Se curityUtil.java:243)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject .java:500)
      at org.apache.catalina.security.SecurityUtil.execute( SecurityUtil.java:275)
      at org.apache.catalina.security.SecurityUtil.doAsPriv ilege(SecurityUtil.java:217)
      at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:197)
      at org.apache.catalina.core.ApplicationFilterChain.ac cess$000(ApplicationFilterChain.java:50)
      at org.apache.catalina.core.ApplicationFilterChain$1. run(ApplicationFilterChain.java:156)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:152)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:96)
      at sun.reflect.GeneratedMethodAccessor226.invoke(Unkn own Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.apache.catalina.security.SecurityUtil$1.run(Se curityUtil.java:243)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject .java:500)
      at org.apache.catalina.security.SecurityUtil.execute( SecurityUtil.java:275)
      at org.apache.catalina.security.SecurityUtil.doAsPriv ilege(SecurityUtil.java:217)
      at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:197)
      at org.apache.catalina.core.ApplicationFilterChain.ac cess$000(ApplicationFilterChain.java:50)
      at org.apache.catalina.core.ApplicationFilterChain$1. run(ApplicationFilterChain.java:156)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:152)
      at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(SecurityAssociationValve.java:175)
      at org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:432)
      at org.jboss.web.tomcat.security.JaccContextValve.inv oke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:105)
      at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve .invoke(CachedConnectionValve.java:156)
      at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:148)
      at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:199)
      at org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:282)
      at org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:767)
      at org.apache.jk.common.ChannelSocket.processConnecti on(ChannelSocket.java:697)
      at org.apache.jk.common.ChannelSocket$SocketConnectio n.runIt(ChannelSocket.java:889)
      at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Thread.java:534)
      Caused by: java.sql.SQLException: I/O Error: Connection reset
      at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCo re.java:1049)
      at net.sourceforge.jtds.jdbc.TdsCore.submitSQL(TdsCor e.java:895)
      at net.sourceforge.jtds.jdbc.ConnectionJDBC2.setAutoC ommit(ConnectionJDBC2.java:2026)
      at org.apache.commons.dbcp.DelegatingConnection.setAu toCommit(DelegatingConnection.java:266)
      at org.apache.commons.dbcp.PoolingDataSource$PoolGuar dConnectionWrapper.setAutoCommit(PoolingDataSource .java:338)
      at org.hibernate.transaction.JDBCTransaction.begin(JD BCTransaction.java:63)
      ... 87 more
      Caused by: java.net.SocketException: Connection reset
      at java.net.SocketInputStream.read(SocketInputStream. java:168)
      at java.io.DataInputStream.readFully(DataInputStream. java:266)
      at java.io.DataInputStream.readFully(DataInputStream. java:242)
      at net.sourceforge.jtds.jdbc.SharedSocket.readPacket( SharedSocket.java:826)
      at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacke t(SharedSocket.java:707)
      at net.sourceforge.jtds.jdbc.ResponseStream.getPacket (ResponseStream.java:466)
      at net.sourceforge.jtds.jdbc.ResponseStream.read(Resp onseStream.java:103)
      at net.sourceforge.jtds.jdbc.ResponseStream.peek(Resp onseStream.java:88)
      at net.sourceforge.jtds.jdbc.TdsCore.wait(TdsCore.jav a:3870)
      at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCo re.java:1042)
      ... 92 more

      Comment


      • #4
        It's a stale db connection problem (connection killed by the server, but still considered alive by the pool). You need to configure connection testing in the connection pool configuration.

        Comment


        • #5
          Thanks

          I'll give it a go! Thanks.

          Comment

          Working...
          X