Error: No ManagedConnections available within configured blocking timeout

http://community.jboss.org/thread/147331

 

 

 

2010-1-27 上午8:21

Error: No ManagedConnections available within configured blocking timeout

- JBoss 4.2.3.GA
- JDK 5 Update 22
- Microsoft SQL Server 2000
- Microsoft SQL Server 2005 JDBC Driver 1.2 (compatible with MSSQL Server 2000)
- Windows Server 2003

 

Hello, everybody!

I have always had this error in JBoss, but I always ignored it deciding not to investigate it any further because it didn't happen very often (once a month in the majority of cases, but less than this in some cases. However yesterday it happened twice), because it was just a matter of restarting the application server, and because it was a very strange error. But now I realize that this error is simply unacceptable bacause it makes an application very unstable and unreliable, even though you are sure that there's nothing wrong in your application to cause it. I'm talking about this error:

 

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] ))

 

I can assure you that I'm not leaking any open database connection in my application. JBoss is configured to check if the application let a connection open and I don't get any message from JBoss telling me this. I'm also closing all ResultSets and Statements. I'm following the rules contained here:

 

http://community.jboss.org/wiki/CanJBossTellMeWhenIDontCloseAConnection

 

This is the pattern I use to close resources:

 

Connection connection = null;
PreparedStatement statement = null;
ResultSet data = null;
try
{
    DataSource ds = get data source with JNDI
    connection = ds.getConnection();
    // ...
}
finally
{
    if (data != null)
    {
        try
        {
            data.close();
        }
        catch (SQLException ex)
        {
        }
    }
    if (statement != null)
    {
        try
        {
            statement.close();
        }
        catch (SQLException ex)
        {
        }
    }
    if (connection != null)
    {
        try
        {
            connection.close();
        }
        catch (SQLException ex)
        {
        }
    }
}

 

I really would like to have a solution to this problem.

 

Thank you in advance.

 

Marcos

 

---------------------------------------------------------------------------------------------------------------

 

11. 2010-6-24 上午9:55 回复: Ricardo Ferreira

Re: Error: No ManagedConnections available within configured blocking timeout

Ok, with two favorable posts suspecting that the problem is in the driver, I think I'll give a chance to it and test the open source driver. But I would like you to elaborate a little more why you think that official MS SQL Server driver has a problem with CallableStatements. Do you have any evidences about this? I really would like to hear from you about that. Anyway this is my datasource configuration file:

 

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
    <jndi-name>BibliotecaDS</jndi-name>
    <connection-url>jdbc:sqlserver://server;databaseName=DBTESEUS</connection-url>
    <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
    <user-name>user-name</user-name>
    <password>password</password>
    <min-pool-size>0</min-pool-size>
    <max-pool-size>25</max-pool-size>
    <idle-timeout-minutes>3</idle-timeout-minutes>
      <new-connection-sql>SELECT 1</new-connection-sql>
      <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
      <metadata>
         <type-mapping>MS SQLSERVER2000</type-mapping>
      </metadata>
  </local-tx-datasource>
</datasources>

 

Marcos

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值