Could not open Hibernate Session for transaction
来源:互联网 发布:数据之魅 中文 pdf 编辑:程序博客网 时间:2024/04/30 06:40
spring2.x+hibernate3+struts2 在首次登陆系统时抛出的异常,再登陆就正常。异常:javax.servlet.ServletException: org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin failed: root cause org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin failed: 解决方案:1.给jdbc url 增加 autoReconnect=true 一定能解决你的问题,可以定期观察一下 show processlist改进方法如下:<property name="url" value="jdbc:mysql://localhost/数据库实例名称?&useUnicode=true&characterEncoding=utf-8&autoReconnect=true"/> 2.寻找支持重连的连接池。 注意:c3p0连接池支持重连;重连参数是: idleConnectionTestPeriod 设置空闲连接测试周期 preferredTestQuery : 设置一查询语句,用于重连测试 testConnectionOnCheckin设置为true testConnectionOnCheckout设置为true 在sessionFactory里配置:<property name="hibernateProperties"> <props> <prop key="hibernate.autoReconnect">true</prop> </props></property>
- Could not open Hibernate Session for transaction
- Could not open Hibernate Session for transaction
- Could not open Hibernate Session for transaction
- Could not open Hibernate Session for transaction
- Could not open Hibernate Session for transaction
- Could not open Hibernate Session for transaction;
- Could not open Hibernate Session for transaction
- Could not open Hibernate Session for transaction
- Could not open Hibernate Session for transaction
- 解决Could not open Hibernate Session for transaction问题
- Could not open Hibernate Session for transaction, 数据库连接超时解决方法
- SSH框架Could not open Hibernate Session for transaction
- Could not open Hibernate Session for transaction, 数据库连接超时解决方法
- Could not open Hibernate Session for transaction, 数据库连接超时解决方法
- 解决Could not open Hibernate Session for transaction问题
- Hibernage错误:Could not open Hibernate Session for transaction
- 解决Could not open Hibernate Session for transaction
- Could not open Hibernate Session for transaction 解决方案
- 龙年贺词成语-龙字成语
- PC替代Server,隐患?还是实惠?
- 2011年专利统计:IBM 6180,苹果 676,Google无缘前50
- vmware 报错
- 扫描线
- Could not open Hibernate Session for transaction
- AndroidManifest.xml文件综合详解
- 系统调用与API的区别
- UML类图关系大全
- Centos下zend Optimizer无法启动的解决方法 [转帖]
- 如何实现应用程序中的”回车”成TAB?
- 2011年度CSDN高校俱乐部“优秀主席”火热出炉
- Linux查看进程的所有子进程和线程
- asi缓存实例