Spring Hibernate从数据库连接未发布

时间:2015-07-10 11:45:29

标签: spring mongodb hibernate

我收到以下错误

Unexpected error 
org.springframework.transaction.CannotCreateTransactionException:

**CannotCreateTransactionException:** Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBC
    Exception: Could not open connection

以下是发生的情况:

我最近将一些表从mysql移到了mongo。编写代码的方式是从mongo / mysql中获取数据。

代码编写在一个方法块中,该方法块使用spring framework提供的@ Transactional 进行注释。

有使用spring提供的事务的hibernate层。 c3p0是连接池。

连接池的参数是

hibernate.c3p0.min_size=5    
hibernate.c3p0.timeout=1200   
hibernate.c3p0.max_size=35      
hibernate.c3p0.max_statements=50

当我们尝试从mongo中提取数据时出现问题。因为mongo操作事务没有被关闭,所以问题就来了。数据库连接没有被释放。它达到了池中定义的最大大小。

尝试在DB中查询以找出连接

show status like '%onn%';

任何解决此问题的建议都会有所帮助。

由于

0 个答案:

没有答案