当前位置:首页 > 开发 > 编程语言 > Hibernate > 正文

org.hibernate.TransactionException: JDBC begin failed解决方案

发表于: 2011-11-10   作者:bozch   来源:转载   浏览:
摘要: org.hibernate.TransactionException: JDBC begin failed:     at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)    at org.hibernate.impl.SessionImp

org.hibernate.TransactionException: JDBC begin failed:
    at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)
    at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:
1326)
    at com.stable.application.common.hibernate.HibernateSessionFactory.beginTransaction(HibernateSessionFactory.java:
136)
    at com.stable.application.common.struts.AduActionServlet.process(AduActionServlet.java:
78)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:
414)
    at com.stable.application.common.struts.AduActionServlet.doGet(AduActionServlet.java:
104)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:
617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:
717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
    at com.stable.application.common.http.filter.UserSessionFilter.doFilter(UserSessionFilter.java:
57)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
    at com.stable.application.common.http.filter.RequestEncodeFilter.doFilter(RequestEncodeFilter.java:
51)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
849)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:
583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:
454)
    at java.lang.Thread.run(Thread.java:
619)
Caused by: java.sql.SQLException: Couldn
't perform the operation getAutoCommit: You can't perform any operations on this connection. It has been automatically closed by Proxool for some reason (see logs).
    at org.logicalcobwebs.proxool.WrappedConnection.invoke(WrappedConnection.java:
207)
    at org.logicalcobwebs.proxool.WrappedConnection.intercept(WrappedConnection.java:
87)
    at $java.sql.Wrapper$$EnhancerByProxool$$1cc186b6.getAutoCommit(
<generated>)
    at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:
57)
    ...
25 more

开发环境:(tomcat,ssh,DBCP连接池)

出现此异常的情况介绍:访问项目搁置一段时间再访问的时候,就出现了如上的异常;

解决方案:

    在spring配置文件中配置数据源的时候,添加如下几项属性配置:

  <!-- 下面三项是确保获得的连接是有效的 -->

  <property name="testOnBorrow" value="true"></property>
  <property name="testOnReturn" value="true"></property>

  <property name="testWhileIdle" value="true"></property>

   <property name="validationQuery" value="SELECT 1"></property>

   <property name="timeBetweenEvictionRunsMillis" value="检查无效连接的时间间隔"></property>
   <property name="minEvictableIdleTimeMillis" value="连接闲置的时间"></property>

 

参考网址:(http://s.yanghao.org/program/viewdetail.php?i=101009

org.hibernate.TransactionException: JDBC begin failed解决方案

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

编辑推荐
Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionExcep
问题:Windows 8.1系统上安装VirtualSVN Server发生Service 'VisualSVN Server' failed to start. P
以前用的eclipse-jee因为在部署项目过程中总是出现bug被我删除。今天去eclipse官网又下了一个Eclips
有时候我们在开发的过程当中,打开Eclipse会出现“failed to create java virtual machine”这样的
  也许有朋友最初在用Android Studio创建新工程的时候会碰到这个错误,其实这个问题是由于版本不
Ready to begin working? The 1st thing you need to have to do is locate the correct pair of sn
gc d:\vm.txt|foreach -begin {write-host "It's beginning."} -process {$_ +"aa"} -end {write-ho
对目前的JavaEE企业应用开发来说,基本都会采用分层的架构, 这样可以分散关注、松散耦合、逻辑复用
对目前的JavaEE企业应用开发来说,基本都会采用分层的架构, 这样可以分散关注、松散耦合、逻辑复用
1.异常处理的语法: 引用 BEGIN TRY { sql_statement | statement_block } END TRY BEGIN CATCH [ {
版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号