2

I have the exception after updating a file and hot deployment it to Tomcat server.
Does anybody know what is wrong?

SEVERE: The web application [/app] registered the JDBC driver [org.postgresql.Driver]  
but failed to unregister it when the web application was stopped.
To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

Env.

     - Tomcat 6 or 7 (the same error)
     - Eclipse Helios
     - JDK 1.7.0_55 with "Default VM parameters":
       -Xms256M -Xmx512M -XX:PermSize=256M -XX:MaxPermSize=512M
Alex
  • 11,451
  • 6
  • 37
  • 52
  • 5
    Probably repeated http://stackoverflow.com/questions/3320400/to-prevent-a-memory-leak-the-jdbc-driver-has-been-forcibly-unregistered – Jorge_B May 08 '14 at 14:55
  • Read this it gave you proper idea regarding this problem. [http://stackoverflow.com/questions/3320400/to-prevent-a-memory-leak-the-jdbc-driver-has-been-forcibly-unregistered](http://stackoverflow.com/questions/3320400/to-prevent-a-memory-leak-the-jdbc-driver-has-been-forcibly-unregistered) – Saranga kapilarathna Mar 28 '16 at 09:34

2 Answers2

1

Meaning of message is that Tomcat already took an action to correct leak caused by not unregistering JDBC driver.

If you're unsure how to unregister JDBC driver in ServletContextListener, you can try something like this:

Enumeration<java .sql.Driver> drivers = java.sql.DriverManager.getDrivers();
while (drivers.hasMoreElements()) {
    java.sql.Driver driver = drivers.nextElement();
    try {
       java.sql.DriverManager.deregisterDriver(driver);
    } catch (Exception e) {
        //log exception or ignore
    }
}
rkosegi
  • 14,165
  • 5
  • 50
  • 83
0

Find the correct JDBC Driver jar and download to the WEB-INF lib folder.

Saranga kapilarathna
  • 564
  • 1
  • 12
  • 25
lamar
  • 19
  • You shouldn't deploy the JDBC driver with the application. See http://stackoverflow.com/questions/3320400/to-prevent-a-memory-leak-the-jdbc-driver-has-been-forcibly-unregistered http://stackoverflow.com/questions/19189312/jdbc-driver-has-been-forcibly-unregistered-by-tomcat-7-why http://stackoverflow.com/questions/24850091/the-web-application-registered-the-jdbc-driver-com-mysql-jdbc-driver-but-fa – Johnny Bigoode Jan 20 '17 at 12:24