We start to get "org.hibernate.exception.GenericJDBCException: Cannot open
connection from DBCP connection pool" error after launching the appication
and after some digging, it seems the problem to be related to the Hibernate
sessions not being closed once the transaction (@Transactional) or
getHibernateTemplate() is done. Without the session closed, the DB
connection won't be returned back to the DB pool. Does anyone have seen this
issue and are there any quick workaround for this critical issue.
We have this defined in the applicationContext-resources.xml for DBCP
Connection Pool in the core module.
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="maxActive" value="10"/>
<property name="maxWait" value="3000"/>
<property name="poolPreparedStatements" value="true"/>
<property name="defaultAutoCommit" value="true"/>
</bean>
Thanks
Todd