I have a very simple application template which includes an embedded apache derby database through hibernate.
I have the following configuration:
After doing some more research I found that closing explicitely all the connections solves the issue:
C3P0Registry.getNumPooledDataSources();
@SuppressWarnings({ "unchecked", "rawtypes" })
Iterator<Set> it = C3P0Registry.getPooledDataSources().iterator();
while (it.hasNext()) {
try {
dataSource = (PooledDataSource) it.next();
dataSource.close();
} catch (Exception e) {
logger.error(e);
}
}
A more concise version of the accepted answer that did the trick for me
for (Object o : C3P0Registry.getPooledDataSources()) {
try {
((PooledDataSource) o).close();
} catch (Exception e) {
// oh well, let tomcat do the complaing for us.
}
}