I have set a JDBCRealm for web-app inside tomcat, and when I reload it I got this from tomcat:
SEVERE: A web application registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
I use tomcat 6.0.24, with MySQL Connector 5.1.10,,,
Is there a way to clean it up, so tomcat won’t display SEVERE message?
This is not a leak, or at least it is one that does not matter. If you have a singleton object (The JDBC driver) and it is never released until the app finishes, does it matter ?
The database will close any pending connections after a given amount of time.
If it really bothers you, you could fix it by overriding close method this way:
And use your XBasicDataSource .