I recently completed transitioning an RMI standalone application (which operated via naming lookup on rmiregistry) to EJBs running under JBoss 4.0.3. The application makes JDBC calls to a database in order to get user/login information.
The problem is that, at seemingly random intervals, requests from the JDBC connection class running on JBoss to the database suddenly start to hang forever, and, in nearly every case, no Java exception is produced in server.log or on the terminal output. The EJBs continue to accept JDNI requests from the associated web application as normal (as evidenced by debug statements), but once the behavior starts, database calls fail to return, producing no error output at all (as far as I can tell), until the JBoss server is restarted and the EJBs reloaded.
I believe I have isolated the stall to the following log4j call (as it is the first in the sequence of logger calls in the database-access sequence not to produce log output):
log.debug("About to get a connection (active count=" + ((oracle.jdbc.pool.OracleConnectionCacheImpl)dataSource).getActiveSize() + ",curr-cache=" + ((oracle.jdbc.pool.OracleConnectionCacheImpl)dataSource).getCacheSize()+")");
The reason that I think this to be a JBoss-related problem is that restarting the JBoss server does correct the problem temporarily, and that the older RMI-registry implementation never had such an issue, despite using exactly the same JDBC code. It has been maddening trying to resolve the problem, as it is essentially impossible to reproduce it on command. Increased usage does seem to be some sort of factor, as the problem occurs more frequently during periods of heavy load (every few hours, as opposed to every few days), but I have yet to successfully induce the malfunction by artificially loading the application with requests. Trying to solve this via trial-and-error would therefore be an extremely slow process.
Has anyone else had a similar problem with getActiveSize() or getCacheSize() calls blocking indefinitely, or with database calls eminating from JBoss-deployed EJBs randomly starting to stall out?