I have an application running on JBoss (4.0.5GA)+Oracle . I know there are connection leaks in the application code. For the time being i am using the "Debug" set to true which automatically closes all the open connections. I have monitored the inuseconnectioncount and things are good.

Sometimes the inuseconnection count reaches to its maximum exhausting it and throwing the "no managed connection available within configured block" error. I have dumped the stack trace of "listinuseconnections()" and found out that all the stack traces are similar meaning they all follow the same pattern, same jsp file, same classes. Does that mean JBoss debug mode is not working for that specfic piece of code? It works on everything else on the application. Can JBoss somehow miss out the connection closing sometimes? I understand this has to been at application level, and we are doing that but just asking!

After a while stop the traffic to the application, if the InUseCount is '0' everything is correct. (I suppose that this is true because if you configure the automatic connection tracking correct it works).

But reaching the maximum mean that the number of parallel access to the DB is more than you have connections, after the blocking-timeout this message will logged and your connection request will interrupted with an Exception.

As applications typically use it in the same manner the stacktrace might every time the same.

So check that you don't have a leak (test above or looking for 'closing a connection for you') and increase your connection-pool-size.

Yes the InUseCount reaches to 0 when no one is using the application. but this case happens once in a blue moon that the all the connections become INUSE and JBoss cannot kill them because they are not IDLE. Limit has been increased to great extent. Can a deadlock in the application code cause this? But why JBoss fails to close those connections even if there is a deadlock.