WARNING [http-nio-8181-exec-550] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc
The web application [comparateur] registered the JDBC 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 used this class
package servlets;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Enumeration;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
public class MyContextListener implements ServletContextListener{
@Override
public void contextDestroyed(ServletContextEvent arg0) {
System.out.println("App shutdown ...");
System.out.println("Deregistering SQL-Drivers ...");
Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements()) {
Driver driver = drivers.nextElement();
try {
DriverManager.deregisterDriver(driver);
System.out.println(driver.getClass().getName());
} catch (SQLException e) {
System.err.println("Error deregistering driver " +
driver.getClass().getName());
}
}
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
}
}
and my connexion with DB
private String dbName = "NameDB";
private String user = "root";
private String pass = "PWD";
private String server = "localhost";
i have the same prob but with this message INFO [http-nio-8181-exec-579]org.apache.catalina.core.ApplicationContext.log HTMLManager: list: Listing contexts for virtual host 'localhost'
Any help appreciated.