Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

running out of ManagedConnections available

 
Karen Gomes
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,

I'm connecting jboss 3.2.3 with SQL server. My project uses session n entity beans and seems to work fine for less load. We are now facing a strange problem. I've set the <max-pool-size> in mssql-ds.xml file to default ie 20, enabled the Trace in the log files that tells me how many jdbc connections are [InUse/Available/Max] from the pool.

This is my mssql-ds.xml

<datasources>
<local-tx-datasource>
<jndi-name>DefaultDS</jndi-name>
<connection-url>jdbc:microsoft:sqlserver://192.168.0.111:1111;DatabaseName=myCCP</connection-url>
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
<user-name>myccp</user-name>
<password>myccp</password>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
<!--<min-pool-size>1</min-pool-size>-->
<!--<max-pool-size>100</max-pool-size>-->
<blocking-timeout-millis>15000</blocking-timeout-millis>
<!-- sql to call on an existing pooled connection when it is obtained from pool
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->
<!--<track-statements>true</track-statements>-->
</local-tx-datasource>
</datasources>

Everything works fine if I send less than 18 requests to the server simultaneously. The problem crops up when the requests exceed 18 .... coz these 18 requests use the 20 max connections. Instead of waiting for connections to be free from the pool they time out giving me an exception.

--------------------------------------------------------------
18:51:27,462 ERROR [LogInterceptor] EJBException, causedBy:
org.jboss.util.NestedSQLException: No ManagedConnections available within configured blocking timeout ( 5000 [ms] ); - nested throwable: (javax.resource.ResourceExcep
No ManagedConnections available within configured blocking timeout ( 5000 [ms] )
--------------------------------------------------------------

I can see all the 20 connections in use at one point. But they don't get freed up after being used for the remaining requests.

When I increase the number of max connections it works fine. But again if I max the connections to 100 and send even 100 requests it throws the exception. I'm not sure where the problem exists. Is it the instance pool or the connection pool that has a problem here.

Has anyone ever had encountered such a problem before?

Thanks
Karuna
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic