C3p0-0.9.5.jar Connection Pool jar package, commonly used in Web projects, when closing connection pooling, do not log off all driver
WORKAROUND: You can declare a subclass of Servletcontextlistener, override the Contextdestroyed (Servletcontextevent arg0) method and add the following code
Enumeration ds = drivermanager.getdrivers (); Try { while (ds.hasmoreelements ()) { = (Driver) ds.nextelement (); Drivermanager.deregisterdriver (d); Catch (SQLException e) { e.printstacktrace ();}
You can close the driver that is registered in the project run, which resolves the error that occurs when the project is closed:
The Web application [/*] registered the JBDC driver [Com.mysql.jdbc.Driver] but failed-unregister it when the Web appli Cation was stopped. To prevent a memory leak, the JDBC Driver have been forcibly unregistered.
Of course, you can also modify the source of the jar, just modify the close () method in the Com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource class, add the above code to the first line of the method ( Because this is to modify the DataSource in the Shutdown method, so do not know whether it will be triggered during the system operation, after all, SPRINGMVC is configured with the close () method, so this method does not know that will not because of repeated registration driver and the speed of the system slows down, is being tested.
Java bug with some jar packages (not updated regularly)