If you have a connection leak you might do a simple test.
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.
I suppose (most reason for that) that there is a long running SQL or an overload of the DB. You might check you application logs whether you find a hint what use case hang.
But for such an old (4.0) version of JBoss it might be that there is bug What version is it exactly?