[ http://issues.apache.org/jira/browse/DBCP-100?page=all ]
Phil Steitz updated DBCP-100: ----------------------------- Bugzilla Id: (was: 35825) Fix Version: 1.2.2 > [dbcp] NullPointerException retrieving connection from the pool > --------------------------------------------------------------- > > Key: DBCP-100 > URL: http://issues.apache.org/jira/browse/DBCP-100 > Project: Commons Dbcp > Type: Bug > Environment: Operating System: Windows XP > Platform: Other > Reporter: Fedor Karpelevitch > Fix For: 1.2.2 > > under some load we start getting this exception when retrieving connection > from > pool: > org.apache.commons.dbcp.SQLNestedException: Could not retrieve connection info > from pool > at > org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPooledConnectionAndInfo(SharedPoolDataSource.java:169) > at > org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:631) > at > org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:615) > at > org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:705) > ... 34 more > Caused by: java.lang.NullPointerException > at > org.apache.commons.collections.SequencedHashMap.insertEntry(SequencedHashMap.java:226) > at > org.apache.commons.collections.SequencedHashMap.put(SequencedHashMap.java:451) > at org.apache.commons.collections.LRUMap.put(LRUMap.java:125) > at > org.apache.commons.dbcp.datasources.SharedPoolDataSource.getUserPassKey(SharedPoolDataSource.java:179) > at > org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPooledConnectionAndInfo(SharedPoolDataSource.java:165) > ... 37 more > this is apparently caused by improper syncronization: > SharedPoolDataSource.getPooledConnectionAndInfo() is synchronized _instance_ > method, but it accesses SharedPoolDataSource.userKeys which is a _static_ > variable, so if you have more than one instance of SharedPoolDataSource (as we > do) access to the map would not be properly synchronized. So either map should > be made instance variable, or the method should be synchronized on the class, > not instance. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]