Search code examples
hibernatetomcatjdbcresource-leak

Monitoring leaked jdbc hibernate connections via web in tomcat


I remember that ~5 years ago I was working on a project that had some url like

http://myhost.com/connections

that showed stacktraces of open connections, so I could easily find out leaks. How can I setup such url now in my tomcat app that uses hibernate? Thank you.


Solution

  • You could look at this project if you are using DBCP. It does not provide stack traces but you can always obtain them via Thread.getAllStackTraces() and filtering against state, name, etc.