Spring - Hibernate - JBOSS - 在配置的阻塞超时(30000 [ms])内没有可用的ManagedConnections [英] Spring - Hibernate - JBOSS - No ManagedConnections available within configured blocking timeout ( 30000 [ms] )

查看:1526
本文介绍了Spring - Hibernate - JBOSS - 在配置的阻塞超时(30000 [ms])内没有可用的ManagedConnections的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Spring 3.0.1和Hibernate 3.2与JBOSS 4.2.2,我们使用Spring事务管理来管理事务。

I am using Spring 3.0.1 and Hibernate 3.2 with JBOSS 4.2.2 and we are using Spring transaction management to manage the transactions.

我的代码实现运行一个巨大的工作运行了近10分钟。Spring服务bean RunJobBean.java是我的工作的入口点,这实例化了一些独立的线程(每个执行不同的数据库更新和其他逻辑等),这些线程调用hibernate DAO bean (这些被注入到RunJobBean,它传递到线程)从DB2服务器读取,并将数据读取和写入两个不同的Oracle数据库(在两个不同的服务器上运行)。

My code implementation runs a huge job that runs for nearly 10 minutes.The spring service bean RunJobBean.java is the entry point for my job and this instantiates a number of independent threads (each performing different DB updates and other logic etc) and these threads invokes the hibernate DAO beans (These are injected into RunJobBean which passes on to threads) to read from DB2 server and reads and writes data into two different Oracle databases (running on two different servers).

Bean StartRunJob.java会执行必要的预处理,并调用RunJobBean来运行作业。

The bean StartRunJob.java does the necessary pre-processing and invokes RunJobBean to run the job.

这样可以在最近更改之前正常工作。

This use to work fine until the recent change.

最近,我们修改了Bean StartRunJob.java(由另一个团队管理,我没有控制权)来并行调用多个作业。所以StartRunJob调用多个独立线程,每个线程调用我的RunJobBean。在运行StartRunJob,我得到下面提到的错误。日志显示这是来自我的代码。

The bean StartRunJob.java (managed by another team. I have no control over this) has been modified recently to invoke multiple jobs in parallel. So StartRunJob invokes multiple independent threads and each of these threads invokes my RunJobBean. On running the StartRunJob, I am getting the below mentioned errors. The log shows this is from my code.

org.hibernate.exception.GenericJDBCException:无法打开连接
Caused by:org.jboss.util.NestedSQLException:在配置的阻塞超时(30000 [ms])内没有可用的ManagedConnections; - 嵌套throwable:(javax.resource.ResourceException:在配置的阻塞超时(30000 [ms])内没有可用的ManagedConnections)

org.hibernate.exception.GenericJDBCException: Cannot open connection Caused by: org.jboss.util.NestedSQLException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] ); - nested throwable: (javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] ))

服务器上配置的最大连接数5和min是1.每个人都认为我的代码连接到Oracle DB1正在吃掉所有的连接,而不是释放它们。 JBOSS控制台显示InUseConnectionCount为3或4或5.但是我仍然看到这个问题。但我的代码连接到第二个OracleDB也有最大连接为5,但我调用12个不同的线程进行DB调用,这很好。

The max number of connections configured on the server is 5 and min is 1. Everyone is under the impression that my code connecting to Oracle DB1 is eating off all the connections and not releasing them. THe JBOSS console shows InUseConnectionCount as 3 or 4 or 5. But still I am seeing this issue. But My code connecting to second OracleDB also has max connections as 5 but I am invoking 12 different threads to made DB calls and this works fine.

我想要一个建议如何我可以getrid这个问题。

I want an advice on how I can getrid of this issue.

提前感谢。

有关这方面的一些问题。
1.如何检查JBOSS中哪个bean持有db连接?
2.如何检查JBOSS有多少个DB连接是空闲的?

Some questions related to this. 1. How can I check in JBOSS which bean is holding a db connection? 2. How can I check in JBOSS how many DB connections are idle?

推荐答案

我已经解决了这个问题。已经识别了事务中的泄漏。

I have solved this problem. Have identified a leak in the transaction.

更新:很久以前我在这个工作,但是我记得,在其中一个事务中,是readonly在哪里,因为它被分配类似于更新,因为这个多个调用由spring触发到DB。当我们把它改成只读时,事情就正常了。

Update: it has been long back I worked on this, But as I remember, In one of the transactions, a property has to be readonly where as it was assigned something similar to update, because of this multiple number of calls were fired by spring to DB. When we changed it to readonly, things were to normal.

但我仍然打开这个问题,让一些专家回答其他问题,以便他们对某人有所帮助。

But I still keep this question open for some expert to answer other questions so they will be helpful to someone.

这篇关于Spring - Hibernate - JBOSS - 在配置的阻塞超时(30000 [ms])内没有可用的ManagedConnections的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆