Error: No ManagedConnections available within configured blocking timeout
marcos_aps Jan 27, 2010 8:21 AM- 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